mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Patch from Devdeep Singh: Removing the older Xenserver java sdk source.
This commit is contained in:
parent
4a9f77610c
commit
75c3f2c999
339
deps/XenServerJava/GPL-2
vendored
339
deps/XenServerJava/GPL-2
vendored
@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) 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
|
||||
this service 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 make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE 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.
|
||||
|
||||
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
|
||||
convey 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision 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, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This 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.
|
||||
35
deps/XenServerJava/LICENSE.txt
vendored
35
deps/XenServerJava/LICENSE.txt
vendored
@ -1,35 +0,0 @@
|
||||
Copyright (c) 2006-2010 Citrix Systems, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of version 2 of the GNU General Public License as published by the
|
||||
Free Software Foundation, with the additional linking exception as follows:
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent modules,
|
||||
and to copy and distribute the resulting executable under terms of your
|
||||
choice, provided that you also meet, for each linked independent module,
|
||||
the terms and conditions of the license of that module. An independent
|
||||
module is a module which is not derived from or based on this library. If
|
||||
you modify this library, you may extend this exception to your version of
|
||||
the library, but you are not obligated to do so. If you do not wish to do
|
||||
so, delete this exception statement from your 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, write to the Free Software Foundation, Inc., 51 Franklin
|
||||
Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
This library may be accompanied by pedagogical examples. These do not form
|
||||
part of this library, and are licensed for redistribution and modification
|
||||
under less restrictive terms. Such examples are licensed clearly at the top
|
||||
of each file.
|
||||
44
deps/XenServerJava/Makefile
vendored
44
deps/XenServerJava/Makefile
vendored
@ -1,44 +0,0 @@
|
||||
# Makefile to compile the Xen Java SDK bindings
|
||||
|
||||
BINDINGJAVAFILES := $(wildcard com/xensource/xenapi/*.java)
|
||||
BINDINGCLASSFILES := $(BINDINGJAVAFILES:.java=.class)
|
||||
BINDINGJAR := xenserver-5.6.100-1.jar
|
||||
|
||||
CLASSPATH := :../cloud-xmlrpc-client-3.1.3.jar:../cloud-xmlrpc-common-3.1.3.jar:../cloud-ws-commons-util-1.0.2.jar
|
||||
EXAMPLECLASSPATH := :$(BINDINGJAR)$(CLASSPATH)
|
||||
|
||||
.PHONY: all
|
||||
all: $(BINDINGJAR) tests
|
||||
@ :
|
||||
|
||||
# Target to compile the automated tests
|
||||
.PHONY: tests
|
||||
tests: $(patsubst %.java,%.class,$(wildcard *.java))
|
||||
@ :
|
||||
|
||||
.PHONY: docs
|
||||
docs:
|
||||
javadoc -classpath ${CLASSPATH} -d doc -link http://java.sun.com/javase/6/docs/api com/xensource/xenapi/*.java
|
||||
|
||||
%.class: %.java
|
||||
javac -cp ${CLASSPATH} $^
|
||||
|
||||
$(BINDINGJAR): $(BINDINGCLASSFILES)
|
||||
jar -cvf $@ com/xensource/xenapi/*.class
|
||||
|
||||
.PHONY: cleanclass
|
||||
cleanclass:
|
||||
rm -f com/xensource/xenapi/*.class
|
||||
rm -f *.class
|
||||
|
||||
.PHONY: cleanjar
|
||||
cleanjar:
|
||||
rm -f $(BINDINGJAR)
|
||||
|
||||
.PHONY: cleandocs
|
||||
cleandocs:
|
||||
rm -rf doc
|
||||
|
||||
.PHONY: clean
|
||||
clean: cleanjar cleanclass cleandocs
|
||||
@ :
|
||||
@ -1,83 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
public enum APIVersion
|
||||
{
|
||||
API_1_1, API_1_2, API_1_3, API_1_4, API_1_5, API_1_6, API_1_7, UNKNOWN;
|
||||
|
||||
public static APIVersion latest()
|
||||
{
|
||||
return API_1_7;
|
||||
}
|
||||
|
||||
public static APIVersion fromMajorMinor(long major, long minor)
|
||||
{
|
||||
if (major == 1 && minor == 7)
|
||||
{
|
||||
return API_1_7;
|
||||
}
|
||||
else if (major == 1 && minor == 6)
|
||||
{
|
||||
return API_1_6;
|
||||
}
|
||||
else if (major == 1 && minor == 5)
|
||||
{
|
||||
return API_1_5;
|
||||
}
|
||||
else if (major == 1 && minor == 4)
|
||||
{
|
||||
return API_1_4;
|
||||
}
|
||||
else if (major == 1 && minor == 3)
|
||||
{
|
||||
return API_1_3;
|
||||
}
|
||||
else if (major == 1 && minor == 2)
|
||||
{
|
||||
return API_1_2;
|
||||
}
|
||||
else if (major == 1 && minor == 1)
|
||||
{
|
||||
return API_1_1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case API_1_1:
|
||||
return "1.1";
|
||||
case API_1_2:
|
||||
return "1.2";
|
||||
case API_1_3:
|
||||
return "1.3";
|
||||
case API_1_4:
|
||||
return "1.4";
|
||||
case API_1_5:
|
||||
return "1.5";
|
||||
case API_1_6:
|
||||
return "1.6";
|
||||
case API_1_7:
|
||||
return "1.7";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,95 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* Management of remote authentication services
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Auth extends XenAPIObject {
|
||||
|
||||
|
||||
public String toWireString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This call queries the external directory service to obtain the subject_identifier as a string from the human-readable subject_name
|
||||
*
|
||||
* @param subjectName The human-readable subject_name, such as a username or a groupname
|
||||
* @return the subject_identifier obtained from the external directory service
|
||||
*/
|
||||
public static String getSubjectIdentifier(Connection c, String subjectName) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "auth.get_subject_identifier";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectName)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This call queries the external directory service to obtain the user information (e.g. username, organization etc) from the specified subject_identifier
|
||||
*
|
||||
* @param subjectIdentifier A string containing the subject_identifier, unique in the external directory service
|
||||
* @return key-value pairs containing at least a key called subject_name
|
||||
*/
|
||||
public static Map<String, String> getSubjectInformationFromIdentifier(Connection c, String subjectIdentifier) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "auth.get_subject_information_from_identifier";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This calls queries the external directory service to obtain the transitively-closed set of groups that the the subject_identifier is member of.
|
||||
*
|
||||
* @param subjectIdentifier A string containing the subject_identifier, unique in the external directory service
|
||||
* @return set of subject_identifiers that provides the group membership of subject_identifier passed as argument, it contains, recursively, all groups a subject_identifier is member of.
|
||||
*/
|
||||
public static Set<String> getGroupMembership(Connection c, String subjectIdentifier) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "auth.get_group_membership";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,384 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A placeholder for a binary blob
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Blob extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Blob(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Blob, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Blob)
|
||||
{
|
||||
Blob other = (Blob) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Blob
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "size", this.size);
|
||||
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
|
||||
print.printf("%1$20s: %2$s\n", "mimeType", this.mimeType);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a blob.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("size", this.size == null ? 0 : this.size);
|
||||
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
|
||||
map.put("mime_type", this.mimeType == null ? "" : this.mimeType);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* a human-readable name
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* a notes field containg human-readable description
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* Size of the binary data, in bytes
|
||||
*/
|
||||
public Long size;
|
||||
/**
|
||||
* Time at which the data in the blob was last updated
|
||||
*/
|
||||
public Date lastUpdated;
|
||||
/**
|
||||
* The mime type associated with this object. Defaults to 'application/octet-stream' if the empty string is supplied
|
||||
*/
|
||||
public String mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given blob.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Blob.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBlobRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the blob instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Blob getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBlob(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the blob instances with the given label.
|
||||
*
|
||||
* @param label label of object to return
|
||||
* @return references to objects with matching names
|
||||
*/
|
||||
public static Set<Blob> getByNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_by_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfBlob(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given blob.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/label field of the given blob.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/description field of the given blob.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameDescription(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size field of the given blob.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getSize(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_size";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_updated field of the given blob.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastUpdated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_last_updated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mime_type field of the given blob.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getMimeType(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_mime_type";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name/label field of the given blob.
|
||||
*
|
||||
* @param label New value to set
|
||||
*/
|
||||
public void setNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.set_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name/description field of the given blob.
|
||||
*
|
||||
* @param description New value to set
|
||||
*/
|
||||
public void setNameDescription(Connection c, String description) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.set_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a placeholder for a binary blob
|
||||
*
|
||||
* @param mimeType The mime-type of the blob. Defaults to 'application/octet-stream' if the empty string is supplied
|
||||
* @return The reference to the created blob
|
||||
*/
|
||||
public static Blob create(Connection c, String mimeType) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(mimeType)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBlob(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the blobs known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Blob> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfBlob(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of blob references to blob records for all blobs known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Blob, Blob.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "blob.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfBlobBlobRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,376 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Bond extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Bond(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Bond, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Bond)
|
||||
{
|
||||
Bond other = (Bond) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Bond
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "master", this.master);
|
||||
print.printf("%1$20s: %2$s\n", "slaves", this.slaves);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Bond.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("master", this.master == null ? new PIF("OpaqueRef:NULL") : this.master);
|
||||
map.put("slaves", this.slaves == null ? new LinkedHashSet<PIF>() : this.slaves);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* The bonded interface
|
||||
*/
|
||||
public PIF master;
|
||||
/**
|
||||
* The interfaces which are part of this bond
|
||||
*/
|
||||
public Set<PIF> slaves;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given Bond.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Bond.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBondRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the Bond instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Bond getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBond(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given Bond.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the master field of the given Bond.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public PIF getMaster(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_master";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the slaves field of the given Bond.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<PIF> getSlaves(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_slaves";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfPIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given Bond.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given Bond.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given Bond.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given Bond. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an interface bond
|
||||
*
|
||||
* @param network Network to add the bonded PIF to
|
||||
* @param members PIFs to add to this bond
|
||||
* @param MAC The MAC address to use on the bond itself. If this parameter is the empty string then the bond will inherit its MAC address from the first of the specified 'members'
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, Network network, Set<PIF> members, String MAC) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.Bond.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an interface bond
|
||||
*
|
||||
* @param network Network to add the bonded PIF to
|
||||
* @param members PIFs to add to this bond
|
||||
* @param MAC The MAC address to use on the bond itself. If this parameter is the empty string then the bond will inherit its MAC address from the first of the specified 'members'
|
||||
* @return The reference of the created Bond object
|
||||
*/
|
||||
public static Bond create(Connection c, Network network, Set<PIF> members, String MAC) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(network), Marshalling.toXMLRPC(members), Marshalling.toXMLRPC(MAC)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBond(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy an interface bond
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.Bond.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy an interface bond
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the Bonds known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Bond> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfBond(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of Bond references to Bond records for all Bonds known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Bond, Bond.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Bond.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfBondBondRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,368 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.apache.xmlrpc.client.XmlRpcClient;
|
||||
import org.apache.xmlrpc.client.XmlRpcClientConfig;
|
||||
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
|
||||
import org.apache.xmlrpc.client.XmlRpcHttpClientConfig;
|
||||
import org.apache.xmlrpc.client.XmlRpcSun15HttpTransportFactory;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.SessionAuthenticationFailed;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
/**
|
||||
* Represents a connection to a XenServer. Creating a new instance of this class initialises a new XmlRpcClient that is
|
||||
* then used by all method calls: each method call in xenapi takes a Connection as a parameter, composes an XMLRPC
|
||||
* method call, and dispatches it on the Connection's client via the dispatch method.
|
||||
*/
|
||||
public class Connection
|
||||
{
|
||||
/**
|
||||
* The version of the bindings that this class belongs to.
|
||||
*/
|
||||
public static final String BINDINGS_VERSION = "5.6.100-1";
|
||||
|
||||
/**
|
||||
* true if the connection is to the Rio edition of XenServer. Certain function calls are not allowed.
|
||||
*
|
||||
* @deprecated Use getAPIVersion() instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Boolean rioConnection = false;
|
||||
|
||||
private APIVersion apiVersion;
|
||||
|
||||
protected int _wait = 600;
|
||||
|
||||
/**
|
||||
* Updated when Session.login_with_password() is called.
|
||||
*/
|
||||
public APIVersion getAPIVersion()
|
||||
{
|
||||
return apiVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* The opaque reference to the session used by this connection
|
||||
*/
|
||||
private String sessionReference;
|
||||
|
||||
/**
|
||||
* As seen by the xmlrpc library. From our point of view it's a server.
|
||||
*/
|
||||
private final XmlRpcClient client;
|
||||
|
||||
private final boolean deprecatedConstructorUsed;
|
||||
|
||||
/**
|
||||
* Creates a connection to a particular server using a given username and password. This object can then be passed
|
||||
* in to any other API calls.
|
||||
*
|
||||
* This constructor calls Session.loginWithPassword, passing itself as the first parameter.
|
||||
*
|
||||
* When this constructor is used, a call to dispose() (also called in the Connection's finalizer) will attempt a
|
||||
* Session.logout on this connection.
|
||||
*
|
||||
* @deprecated Use a constructor that takes a URL as the first parameter instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Connection(String client, String username, String password) throws java.net.MalformedURLException,
|
||||
XmlRpcException, BadServerResponse, SessionAuthenticationFailed, XenAPIException
|
||||
{
|
||||
deprecatedConstructorUsed = true;
|
||||
|
||||
// To login normally we call login_with_password(username, password, "1.X"). On rio this call fails and we
|
||||
// should use login_with_password(username,password) instead, and note that we are talking to a rio host so that we
|
||||
// can refuse to make certain miami-specific calls
|
||||
final String ApiVersion = APIVersion.latest().toString();
|
||||
this.client = getClientFromURL(new URL(client));
|
||||
try
|
||||
{
|
||||
//first try to login the modern way
|
||||
this.sessionReference = loginWithPassword(this.client, username, password, ApiVersion);
|
||||
} catch (BadServerResponse e)
|
||||
{
|
||||
//oops, something went wrong
|
||||
String[] errDesc = e.errorDescription;
|
||||
//was the problem that the host was running rio? If so it will have complained that it got three parameters
|
||||
//instead of two. Let us carefully verify the details of this complaint
|
||||
if (0 == errDesc[0].compareTo("MESSAGE_PARAMETER_COUNT_MISMATCH")
|
||||
&& 0 == errDesc[1].compareTo("session.login_with_password")
|
||||
&& 0 == errDesc[2].compareTo("2")
|
||||
&& 0 == errDesc[3].compareTo("3"))
|
||||
{
|
||||
//and if so, we can have another go, using the older login method, and see how that goes.
|
||||
this.sessionReference = loginWithPassword(this.client, username, password);
|
||||
//success!. Note that we are talking to an old host on this connection
|
||||
this.rioConnection = true;
|
||||
} else
|
||||
{
|
||||
//Hmm... Can't solve this here. Let upstairs know about the problem.
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
setAPIVersion(new Session(sessionReference));
|
||||
}
|
||||
catch (XenAPIException exn)
|
||||
{
|
||||
dispose();
|
||||
throw exn;
|
||||
}
|
||||
catch (XmlRpcException exn)
|
||||
{
|
||||
dispose();
|
||||
throw exn;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a connection to a particular server using a given username and password. This object can then be passed
|
||||
* in to any other API calls.
|
||||
*
|
||||
* Note this constructor does NOT call Session.loginWithPassword; the programmer is responsible for calling it,
|
||||
* passing the Connection as a parameter. No attempt to connect to the server is made until login is called.
|
||||
*
|
||||
* When this constructor is used, a call to dispose() will do nothing. The programmer is responsible for manually
|
||||
* logging out the Session.
|
||||
*/
|
||||
public Connection(URL url, int wait)
|
||||
{
|
||||
deprecatedConstructorUsed = false;
|
||||
_wait = wait;
|
||||
this.client = getClientFromURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a connection to a particular server using a given username and password. This object can then be passed
|
||||
* in to any other API calls.
|
||||
*
|
||||
* The additional sessionReference parameter must be a reference to a logged-in Session. Any method calls on this
|
||||
* Connection will use it. This constructor does not call Session.loginWithPassword, and dispose() on the resulting
|
||||
* Connection object does not call Session.logout. The programmer is responsible for ensuring the Session is logged
|
||||
* in and out correctly.
|
||||
*/
|
||||
public Connection(URL url, String sessionReference)
|
||||
{
|
||||
deprecatedConstructorUsed = false;
|
||||
|
||||
this.client = getClientFromURL(url);
|
||||
this.sessionReference = sessionReference;
|
||||
}
|
||||
|
||||
protected void finalize() throws Throwable
|
||||
{
|
||||
dispose();
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Nothrow guarantee.
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
if (!deprecatedConstructorUsed)
|
||||
{
|
||||
// We only need to do the Session.logout if they used the old deprecated constructor.
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (sessionReference != null)
|
||||
{
|
||||
String method_call = "session.logout";
|
||||
Object[] method_params = { Marshalling.toXMLRPC(this.sessionReference) };
|
||||
client.execute(method_call, method_params);
|
||||
sessionReference = null;
|
||||
}
|
||||
}
|
||||
catch (XmlRpcException exn)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated The programmer is now responsible for calling login/logout themselves.
|
||||
*/
|
||||
@Deprecated
|
||||
private static String loginWithPassword(XmlRpcClient client, String username, String password)
|
||||
throws BadServerResponse, XmlRpcException, SessionAuthenticationFailed
|
||||
{
|
||||
String method_call = "session.login_with_password";
|
||||
Object[] method_params = { Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password) };
|
||||
Map response = (Map) client.execute(method_call, method_params);
|
||||
if (response.get("Status").equals("Success"))
|
||||
{
|
||||
return (String) response.get("Value");
|
||||
} else if (response.get("Status").equals("Failure"))
|
||||
{
|
||||
Object[] error = (Object[]) response.get("ErrorDescription");
|
||||
if (error[0].equals("SESSION_AUTHENTICATION_FAILED"))
|
||||
{
|
||||
throw new SessionAuthenticationFailed();
|
||||
}
|
||||
}
|
||||
throw new BadServerResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated The programmer is now responsible for calling login/logout themselves.
|
||||
*/
|
||||
@Deprecated
|
||||
private static String loginWithPassword(XmlRpcClient client, String username, String password, String ApiVersion)
|
||||
throws BadServerResponse, XmlRpcException, SessionAuthenticationFailed
|
||||
{
|
||||
String method_call = "session.login_with_password";
|
||||
Object[] method_params = { Marshalling.toXMLRPC(username), Marshalling.toXMLRPC(password),
|
||||
Marshalling.toXMLRPC(ApiVersion) };
|
||||
Map response = (Map) client.execute(method_call, method_params);
|
||||
if (response.get("Status").equals("Success"))
|
||||
{
|
||||
return (String) response.get("Value");
|
||||
} else if (response.get("Status").equals("Failure"))
|
||||
{
|
||||
Object[] error = (Object[]) response.get("ErrorDescription");
|
||||
if (error[0].equals("SESSION_AUTHENTICATION_FAILED"))
|
||||
{
|
||||
throw new SessionAuthenticationFailed();
|
||||
}
|
||||
}
|
||||
throw new BadServerResponse(response);
|
||||
}
|
||||
|
||||
private XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
|
||||
|
||||
public XmlRpcClientConfigImpl getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
protected XmlRpcClient getClientFromURL(URL url)
|
||||
{
|
||||
config.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
config.setServerURL(url);
|
||||
config.setReplyTimeout(_wait * 1000);
|
||||
config.setConnectionTimeout(5000);
|
||||
XmlRpcClient client = new XmlRpcClient();
|
||||
client.setConfig(config);
|
||||
return client;
|
||||
}
|
||||
|
||||
/*
|
||||
* Because the binding calls are constructing their own parameter lists, they need to be able to get to
|
||||
* the session reference directly. This is all rather ugly and needs redone
|
||||
* Changed to public to allow easier integration with HTTP-level streaming interface,
|
||||
* see CA-15447
|
||||
*/
|
||||
public String getSessionReference()
|
||||
{
|
||||
return this.sessionReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* The (auto-generated parts of) the bindings dispatch XMLRPC calls on this Connection's client through this method.
|
||||
*/
|
||||
protected Map dispatch(String method_call, Object[] method_params) throws XmlRpcException, XenAPIException
|
||||
{
|
||||
Map response = (Map) client.execute(method_call, method_params);
|
||||
|
||||
if (!deprecatedConstructorUsed)
|
||||
{
|
||||
// We are using the new-style constructor which doesn't perform login.
|
||||
// Set this Connection's Session reference from the value returned on the wire.
|
||||
if (method_call.equals("session.login_with_password") &&
|
||||
response.get("Status").equals("Success"))
|
||||
{
|
||||
// Store the Session reference and ask the server what the
|
||||
// API version it's using is.
|
||||
Session session = Types.toSession(response.get("Value"));
|
||||
sessionReference = session.ref;
|
||||
setAPIVersion(session);
|
||||
}
|
||||
else if (method_call.equals("session.slave_local_login_with_password") &&
|
||||
response.get("Status").equals("Success"))
|
||||
{
|
||||
// Store the Session reference and assume API version 1.2.
|
||||
sessionReference = Types.toSession(response.get("Value")).ref;
|
||||
apiVersion = APIVersion.API_1_2;
|
||||
}
|
||||
else if (method_call.equals("session.logout"))
|
||||
{
|
||||
// Work around a bug in XenServer 5.0 and below.
|
||||
// session.login_with_password should have rejected us with
|
||||
// HOST_IS_SLAVE, but instead we don't find out until later.
|
||||
// We don't want to leak the session, so we need to log out
|
||||
// this session from the master instead.
|
||||
if (response.get("Status").equals("Failure"))
|
||||
{
|
||||
Object[] error = (Object[]) response.get("ErrorDescription");
|
||||
if (error.length == 2 && error[0].equals("HOST_IS_SLAVE"))
|
||||
{
|
||||
try
|
||||
{
|
||||
URL client_url =
|
||||
((XmlRpcHttpClientConfig)client.getClientConfig()).getServerURL();
|
||||
Connection tmp_conn =
|
||||
new Connection(new URL(client_url.getProtocol(),
|
||||
(String)error[1],
|
||||
client_url.getPort(),
|
||||
client_url.getFile()), _wait);
|
||||
tmp_conn.sessionReference = sessionReference;
|
||||
try
|
||||
{
|
||||
Session.logout(tmp_conn);
|
||||
}
|
||||
finally
|
||||
{
|
||||
tmp_conn.dispose();
|
||||
}
|
||||
}
|
||||
catch (Exception exn2)
|
||||
{
|
||||
// Ignore -- we're going to throw HostIsSlave anyway.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the stored Session reference.
|
||||
this.sessionReference = null;
|
||||
}
|
||||
}
|
||||
|
||||
return Types.checkResponse(response);
|
||||
}
|
||||
|
||||
|
||||
private void setAPIVersion(Session session) throws XenAPIException, XmlRpcException
|
||||
{
|
||||
try
|
||||
{
|
||||
long major = session.getThisHost(this).getAPIVersionMajor(this);
|
||||
long minor = session.getThisHost(this).getAPIVersionMinor(this);
|
||||
apiVersion = APIVersion.fromMajorMinor(major, minor);
|
||||
}
|
||||
catch (BadServerResponse exn)
|
||||
{
|
||||
apiVersion = APIVersion.API_1_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,397 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A console
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Console extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Console(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Console, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Console)
|
||||
{
|
||||
Console other = (Console) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Console
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "protocol", this.protocol);
|
||||
print.printf("%1$20s: %2$s\n", "location", this.location);
|
||||
print.printf("%1$20s: %2$s\n", "VM", this.VM);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a console.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("protocol", this.protocol == null ? Types.ConsoleProtocol.UNRECOGNIZED : this.protocol);
|
||||
map.put("location", this.location == null ? "" : this.location);
|
||||
map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* the protocol used by this console
|
||||
*/
|
||||
public Types.ConsoleProtocol protocol;
|
||||
/**
|
||||
* URI for the console service
|
||||
*/
|
||||
public String location;
|
||||
/**
|
||||
* VM to which this console is attached
|
||||
*/
|
||||
public VM VM;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given console.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Console.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toConsoleRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the console instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Console getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toConsole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new console instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, Console.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.console.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new console instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
public static Console create(Connection c, Console.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toConsole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified console instance.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.console.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified console instance.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given console.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the protocol field of the given console.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Types.ConsoleProtocol getProtocol(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_protocol";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toConsoleProtocol(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location field of the given console.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getLocation(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_location";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VM field of the given console.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public VM getVM(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_VM";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given console.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given console.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given console.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given console. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the consoles known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Console> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfConsole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of console references to console records for all consoles known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Console, Console.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "console.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfConsoleConsoleRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,336 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A VM crashdump
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Crashdump extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Crashdump(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Crashdump, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Crashdump)
|
||||
{
|
||||
Crashdump other = (Crashdump) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Crashdump
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "VM", this.VM);
|
||||
print.printf("%1$20s: %2$s\n", "VDI", this.VDI);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a crashdump.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM);
|
||||
map.put("VDI", this.VDI == null ? new VDI("OpaqueRef:NULL") : this.VDI);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* the virtual machine
|
||||
*/
|
||||
public VM VM;
|
||||
/**
|
||||
* the virtual disk
|
||||
*/
|
||||
public VDI VDI;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given crashdump.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Crashdump.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toCrashdumpRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the crashdump instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Crashdump getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toCrashdump(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VM field of the given crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public VM getVM(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_VM";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VDI field of the given crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public VDI getVDI(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_VDI";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVDI(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given crashdump.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given crashdump.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given crashdump. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified crashdump
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.crashdump.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified crashdump
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the crashdumps known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Crashdump> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfCrashdump(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of crashdump references to crashdump records for all crashdumps known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Crashdump, Crashdump.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "crashdump.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfCrashdumpCrashdumpRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,142 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* Data sources for logging in RRDs
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class DataSource extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
DataSource(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a DataSource, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof DataSource)
|
||||
{
|
||||
DataSource other = (DataSource) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a DataSource
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "enabled", this.enabled);
|
||||
print.printf("%1$20s: %2$s\n", "standard", this.standard);
|
||||
print.printf("%1$20s: %2$s\n", "units", this.units);
|
||||
print.printf("%1$20s: %2$s\n", "min", this.min);
|
||||
print.printf("%1$20s: %2$s\n", "max", this.max);
|
||||
print.printf("%1$20s: %2$s\n", "value", this.value);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a data_source.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("enabled", this.enabled == null ? false : this.enabled);
|
||||
map.put("standard", this.standard == null ? false : this.standard);
|
||||
map.put("units", this.units == null ? "" : this.units);
|
||||
map.put("min", this.min == null ? 0.0 : this.min);
|
||||
map.put("max", this.max == null ? 0.0 : this.max);
|
||||
map.put("value", this.value == null ? 0.0 : this.value);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* a human-readable name
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* a notes field containg human-readable description
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* true if the data source is being logged
|
||||
*/
|
||||
public Boolean enabled;
|
||||
/**
|
||||
* true if the data source is enabled by default. Non-default data sources cannot be disabled
|
||||
*/
|
||||
public Boolean standard;
|
||||
/**
|
||||
* the units of the value
|
||||
*/
|
||||
public String units;
|
||||
/**
|
||||
* the minimum value of the data source
|
||||
*/
|
||||
public Double min;
|
||||
/**
|
||||
* the maximum value of the data source
|
||||
*/
|
||||
public Double max;
|
||||
/**
|
||||
* current value of the data source
|
||||
*/
|
||||
public Double value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,242 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
/**
|
||||
* Asynchronous event registration and handling
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Event extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Event(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Event, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Event)
|
||||
{
|
||||
Event other = (Event) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Event
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "id", this.id);
|
||||
print.printf("%1$20s: %2$s\n", "timestamp", this.timestamp);
|
||||
print.printf("%1$20s: %2$s\n", "clazz", this.clazz);
|
||||
print.printf("%1$20s: %2$s\n", "operation", this.operation);
|
||||
print.printf("%1$20s: %2$s\n", "ref", this.ref);
|
||||
print.printf("%1$20s: %2$s\n", "objUuid", this.objUuid);
|
||||
print.printf("%1$20s: %2$s\n", "snapshot", this.snapshot);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a event.Record to a Map
|
||||
*/
|
||||
@Override
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("id", this.id == null ? 0 : this.id);
|
||||
map.put("timestamp", this.timestamp == null ? new Date(0) : this.timestamp);
|
||||
map.put("class", this.clazz == null ? "" : this.clazz);
|
||||
map.put("operation", this.operation == null ? Types.EventOperation.UNRECOGNIZED : this.operation);
|
||||
map.put("ref", this.ref == null ? "" : this.ref);
|
||||
map.put("obj_uuid", this.objUuid == null ? "" : this.objUuid);
|
||||
map.put("snapshot", this.snapshot);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* An ID, monotonically increasing, and local to the current session
|
||||
*/
|
||||
public Long id;
|
||||
/**
|
||||
* The time at which the event occurred
|
||||
*/
|
||||
public Date timestamp;
|
||||
/**
|
||||
* The name of the class of the object that changed
|
||||
*/
|
||||
public String clazz;
|
||||
/**
|
||||
* The operation that was performed
|
||||
*/
|
||||
public Types.EventOperation operation;
|
||||
/**
|
||||
* A reference to the object that changed
|
||||
*/
|
||||
public String ref;
|
||||
/**
|
||||
* The uuid of the object that changed
|
||||
*/
|
||||
public String objUuid;
|
||||
/**
|
||||
* The record of the database object that was added, changed or deleted
|
||||
* (the actual type will be VM.Record, VBD.Record or similar)
|
||||
*/
|
||||
public Object snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this session with the event system. Specifying the empty list will register for all classes.
|
||||
*
|
||||
* @param classes register for events for the indicated classes
|
||||
* @return Task
|
||||
*/
|
||||
public static Task registerAsync(Connection c, Set<String> classes) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.event.register";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this session with the event system. Specifying the empty list will register for all classes.
|
||||
*
|
||||
* @param classes register for events for the indicated classes
|
||||
*/
|
||||
public static void register(Connection c, Set<String> classes) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "event.register";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this session with the event system
|
||||
*
|
||||
* @param classes remove this session's registration for the indicated classes
|
||||
* @return Task
|
||||
*/
|
||||
public static Task unregisterAsync(Connection c, Set<String> classes) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.event.unregister";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this session with the event system
|
||||
*
|
||||
* @param classes remove this session's registration for the indicated classes
|
||||
*/
|
||||
public static void unregister(Connection c, Set<String> classes) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "event.unregister";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(classes)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocking call which returns a (possibly empty) batch of events
|
||||
*
|
||||
* @return the batch of events
|
||||
*/
|
||||
public static Set<Event.Record> next(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.SessionNotRegistered,
|
||||
Types.EventsLost {
|
||||
String method_call = "event.next";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfEventRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ID of the next event to be generated by the system
|
||||
*
|
||||
* @return the event ID
|
||||
*/
|
||||
public static Long getCurrentId(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "event.get_current_id";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
}
|
||||
2752
deps/XenServerJava/src/com/xensource/xenapi/Host.java
vendored
2752
deps/XenServerJava/src/com/xensource/xenapi/Host.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,514 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A physical CPU
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class HostCpu extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
HostCpu(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a HostCpu, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof HostCpu)
|
||||
{
|
||||
HostCpu other = (HostCpu) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a HostCpu
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "host", this.host);
|
||||
print.printf("%1$20s: %2$s\n", "number", this.number);
|
||||
print.printf("%1$20s: %2$s\n", "vendor", this.vendor);
|
||||
print.printf("%1$20s: %2$s\n", "speed", this.speed);
|
||||
print.printf("%1$20s: %2$s\n", "modelname", this.modelname);
|
||||
print.printf("%1$20s: %2$s\n", "family", this.family);
|
||||
print.printf("%1$20s: %2$s\n", "model", this.model);
|
||||
print.printf("%1$20s: %2$s\n", "stepping", this.stepping);
|
||||
print.printf("%1$20s: %2$s\n", "flags", this.flags);
|
||||
print.printf("%1$20s: %2$s\n", "features", this.features);
|
||||
print.printf("%1$20s: %2$s\n", "utilisation", this.utilisation);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a host_cpu.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host);
|
||||
map.put("number", this.number == null ? 0 : this.number);
|
||||
map.put("vendor", this.vendor == null ? "" : this.vendor);
|
||||
map.put("speed", this.speed == null ? 0 : this.speed);
|
||||
map.put("modelname", this.modelname == null ? "" : this.modelname);
|
||||
map.put("family", this.family == null ? 0 : this.family);
|
||||
map.put("model", this.model == null ? 0 : this.model);
|
||||
map.put("stepping", this.stepping == null ? "" : this.stepping);
|
||||
map.put("flags", this.flags == null ? "" : this.flags);
|
||||
map.put("features", this.features == null ? "" : this.features);
|
||||
map.put("utilisation", this.utilisation == null ? 0.0 : this.utilisation);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* the host the CPU is in
|
||||
*/
|
||||
public Host host;
|
||||
/**
|
||||
* the number of the physical CPU within the host
|
||||
*/
|
||||
public Long number;
|
||||
/**
|
||||
* the vendor of the physical CPU
|
||||
*/
|
||||
public String vendor;
|
||||
/**
|
||||
* the speed of the physical CPU
|
||||
*/
|
||||
public Long speed;
|
||||
/**
|
||||
* the model name of the physical CPU
|
||||
*/
|
||||
public String modelname;
|
||||
/**
|
||||
* the family (number) of the physical CPU
|
||||
*/
|
||||
public Long family;
|
||||
/**
|
||||
* the model number of the physical CPU
|
||||
*/
|
||||
public Long model;
|
||||
/**
|
||||
* the stepping of the physical CPU
|
||||
*/
|
||||
public String stepping;
|
||||
/**
|
||||
* the flags of the physical CPU (a decoded version of the features field)
|
||||
*/
|
||||
public String flags;
|
||||
/**
|
||||
* the physical CPU feature bitmap
|
||||
*/
|
||||
public String features;
|
||||
/**
|
||||
* the current CPU utilisation
|
||||
*/
|
||||
public Double utilisation;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given host_cpu.
|
||||
* @deprecated
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
@Deprecated public HostCpu.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostCpuRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the host_cpu instance with the specified UUID.
|
||||
* @deprecated
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
@Deprecated public static HostCpu getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostCpu(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Host getHost(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_host";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHost(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getNumber(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_number";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vendor field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getVendor(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_vendor";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the speed field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getSpeed(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_speed";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the modelname field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getModelname(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_modelname";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the family field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getFamily(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_family";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getModel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_model";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stepping field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getStepping(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_stepping";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the flags field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getFlags(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_flags";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the features field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getFeatures(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_features";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the utilisation field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getUtilisation(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_utilisation";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given host_cpu.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given host_cpu.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given host_cpu.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given host_cpu. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the host_cpus known to the system.
|
||||
* @deprecated
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
@Deprecated public static Set<HostCpu> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfHostCpu(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of host_cpu references to host_cpu records for all host_cpus known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<HostCpu, HostCpu.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_cpu.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfHostCpuHostCpuRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,395 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* Represents a host crash dump
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class HostCrashdump extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
HostCrashdump(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a HostCrashdump, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof HostCrashdump)
|
||||
{
|
||||
HostCrashdump other = (HostCrashdump) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a HostCrashdump
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "host", this.host);
|
||||
print.printf("%1$20s: %2$s\n", "timestamp", this.timestamp);
|
||||
print.printf("%1$20s: %2$s\n", "size", this.size);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a host_crashdump.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host);
|
||||
map.put("timestamp", this.timestamp == null ? new Date(0) : this.timestamp);
|
||||
map.put("size", this.size == null ? 0 : this.size);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* Host the crashdump relates to
|
||||
*/
|
||||
public Host host;
|
||||
/**
|
||||
* Time the crash happened
|
||||
*/
|
||||
public Date timestamp;
|
||||
/**
|
||||
* Size of the crashdump
|
||||
*/
|
||||
public Long size;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given host_crashdump.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public HostCrashdump.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostCrashdumpRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the host_crashdump instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static HostCrashdump getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostCrashdump(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given host_crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host field of the given host_crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Host getHost(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_host";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHost(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the timestamp field of the given host_crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getTimestamp(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_timestamp";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size field of the given host_crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getSize(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_size";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given host_crashdump.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given host_crashdump.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given host_crashdump.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given host_crashdump. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy specified host crash dump, removing it from the disk.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.host_crashdump.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy specified host crash dump, removing it from the disk.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the specified host crash dump to a specified URL
|
||||
*
|
||||
* @param url The URL to upload to
|
||||
* @param options Extra configuration operations
|
||||
* @return Task
|
||||
*/
|
||||
public Task uploadAsync(Connection c, String url, Map<String, String> options) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.host_crashdump.upload";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(url), Marshalling.toXMLRPC(options)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the specified host crash dump to a specified URL
|
||||
*
|
||||
* @param url The URL to upload to
|
||||
* @param options Extra configuration operations
|
||||
*/
|
||||
public void upload(Connection c, String url, Map<String, String> options) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.upload";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(url), Marshalling.toXMLRPC(options)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the host_crashdumps known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<HostCrashdump> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfHostCrashdump(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of host_crashdump references to host_crashdump records for all host_crashdumps known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<HostCrashdump, HostCrashdump.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_crashdump.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfHostCrashdumpHostCrashdumpRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,351 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* The metrics associated with a host
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class HostMetrics extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
HostMetrics(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a HostMetrics, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof HostMetrics)
|
||||
{
|
||||
HostMetrics other = (HostMetrics) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a HostMetrics
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "memoryTotal", this.memoryTotal);
|
||||
print.printf("%1$20s: %2$s\n", "memoryFree", this.memoryFree);
|
||||
print.printf("%1$20s: %2$s\n", "live", this.live);
|
||||
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a host_metrics.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("memory_total", this.memoryTotal == null ? 0 : this.memoryTotal);
|
||||
map.put("memory_free", this.memoryFree == null ? 0 : this.memoryFree);
|
||||
map.put("live", this.live == null ? false : this.live);
|
||||
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* Total host memory (bytes)
|
||||
*/
|
||||
public Long memoryTotal;
|
||||
/**
|
||||
* Free host memory (bytes)
|
||||
*/
|
||||
public Long memoryFree;
|
||||
/**
|
||||
* Pool master thinks this host is live
|
||||
*/
|
||||
public Boolean live;
|
||||
/**
|
||||
* Time at which this information was last updated
|
||||
*/
|
||||
public Date lastUpdated;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given host_metrics.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public HostMetrics.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostMetricsRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the host_metrics instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static HostMetrics getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given host_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the memory/total field of the given host_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getMemoryTotal(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_memory_total";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the memory/free field of the given host_metrics.
|
||||
* @deprecated
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
@Deprecated public Long getMemoryFree(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_memory_free";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the live field of the given host_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getLive(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_live";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_updated field of the given host_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastUpdated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_last_updated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given host_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given host_metrics.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given host_metrics.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given host_metrics. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the host_metrics instances known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<HostMetrics> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfHostMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of host_metrics references to host_metrics records for all host_metrics instances known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<HostMetrics, HostMetrics.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_metrics.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfHostMetricsHostMetricsRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,530 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* Represents a patch stored on a server
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class HostPatch extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
HostPatch(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a HostPatch, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof HostPatch)
|
||||
{
|
||||
HostPatch other = (HostPatch) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a HostPatch
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "version", this.version);
|
||||
print.printf("%1$20s: %2$s\n", "host", this.host);
|
||||
print.printf("%1$20s: %2$s\n", "applied", this.applied);
|
||||
print.printf("%1$20s: %2$s\n", "timestampApplied", this.timestampApplied);
|
||||
print.printf("%1$20s: %2$s\n", "size", this.size);
|
||||
print.printf("%1$20s: %2$s\n", "poolPatch", this.poolPatch);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a host_patch.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("version", this.version == null ? "" : this.version);
|
||||
map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host);
|
||||
map.put("applied", this.applied == null ? false : this.applied);
|
||||
map.put("timestamp_applied", this.timestampApplied == null ? new Date(0) : this.timestampApplied);
|
||||
map.put("size", this.size == null ? 0 : this.size);
|
||||
map.put("pool_patch", this.poolPatch == null ? new PoolPatch("OpaqueRef:NULL") : this.poolPatch);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* a human-readable name
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* a notes field containg human-readable description
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* Patch version number
|
||||
*/
|
||||
public String version;
|
||||
/**
|
||||
* Host the patch relates to
|
||||
*/
|
||||
public Host host;
|
||||
/**
|
||||
* True if the patch has been applied
|
||||
*/
|
||||
public Boolean applied;
|
||||
/**
|
||||
* Time the patch was applied
|
||||
*/
|
||||
public Date timestampApplied;
|
||||
/**
|
||||
* Size of the patch
|
||||
*/
|
||||
public Long size;
|
||||
/**
|
||||
* The patch applied
|
||||
*/
|
||||
public PoolPatch poolPatch;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given host_patch.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public HostPatch.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostPatchRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the host_patch instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static HostPatch getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHostPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the host_patch instances with the given label.
|
||||
*
|
||||
* @param label label of object to return
|
||||
* @return references to objects with matching names
|
||||
*/
|
||||
public static Set<HostPatch> getByNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_by_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfHostPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/label field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/description field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameDescription(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getVersion(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_version";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Host getHost(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_host";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHost(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the applied field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getApplied(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_applied";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the timestamp_applied field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getTimestampApplied(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_timestamp_applied";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getSize(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_size";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pool_patch field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public PoolPatch getPoolPatch(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_pool_patch";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPoolPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given host_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given host_patch.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given host_patch.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given host_patch. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified host patch, removing it from the disk. This does NOT reverse the patch
|
||||
* @deprecated
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
@Deprecated public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.host_patch.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified host patch, removing it from the disk. This does NOT reverse the patch
|
||||
* @deprecated
|
||||
*
|
||||
*/
|
||||
@Deprecated public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the selected patch and return its output
|
||||
* @deprecated
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
@Deprecated public Task applyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.host_patch.apply";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the selected patch and return its output
|
||||
* @deprecated
|
||||
*
|
||||
* @return the output of the patch application process
|
||||
*/
|
||||
@Deprecated public String apply(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.apply";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the host_patchs known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<HostPatch> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfHostPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of host_patch references to host_patch records for all host_patchs known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<HostPatch, HostPatch.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "host_patch.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfHostPatchHostPatchRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Marshalls Java types onto the wire.
|
||||
* Does not cope with records. Use individual record.toMap()
|
||||
*/
|
||||
public final class Marshalling {
|
||||
/**
|
||||
* Converts Integers to Strings
|
||||
* and Sets to Lists recursively.
|
||||
*/
|
||||
public static Object toXMLRPC(Object o) {
|
||||
if (o instanceof String ||
|
||||
o instanceof Boolean ||
|
||||
o instanceof Double ||
|
||||
o instanceof Date) {
|
||||
return o;
|
||||
} else if (o instanceof Long) {
|
||||
return o.toString();
|
||||
} else if (o instanceof Map) {
|
||||
Map<Object, Object> result = new HashMap<Object, Object>();
|
||||
Map m = (Map)o;
|
||||
for (Object k : m.keySet())
|
||||
{
|
||||
result.put(toXMLRPC(k), toXMLRPC(m.get(k)));
|
||||
}
|
||||
return result;
|
||||
} else if (o instanceof Set) {
|
||||
List<Object> result = new ArrayList<Object>();
|
||||
for (Object e : ((Set)o))
|
||||
{
|
||||
result.add(toXMLRPC(e));
|
||||
}
|
||||
return result;
|
||||
} else if (o instanceof XenAPIObject) {
|
||||
return ((XenAPIObject) o).toWireString();
|
||||
} else if (o instanceof Enum) {
|
||||
return o.toString();
|
||||
}else if (o == null){
|
||||
return "";
|
||||
} else {
|
||||
throw new RuntimeException ("=============don't know how to marshall:({[" + o + "]})");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,298 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* An message for the attention of the administrator
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Message extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Message(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Message, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Message)
|
||||
{
|
||||
Message other = (Message) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Message
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "name", this.name);
|
||||
print.printf("%1$20s: %2$s\n", "priority", this.priority);
|
||||
print.printf("%1$20s: %2$s\n", "cls", this.cls);
|
||||
print.printf("%1$20s: %2$s\n", "objUuid", this.objUuid);
|
||||
print.printf("%1$20s: %2$s\n", "timestamp", this.timestamp);
|
||||
print.printf("%1$20s: %2$s\n", "body", this.body);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a message.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name", this.name == null ? "" : this.name);
|
||||
map.put("priority", this.priority == null ? 0 : this.priority);
|
||||
map.put("cls", this.cls == null ? Types.Cls.UNRECOGNIZED : this.cls);
|
||||
map.put("obj_uuid", this.objUuid == null ? "" : this.objUuid);
|
||||
map.put("timestamp", this.timestamp == null ? new Date(0) : this.timestamp);
|
||||
map.put("body", this.body == null ? "" : this.body);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* The name of the message
|
||||
*/
|
||||
public String name;
|
||||
/**
|
||||
* The message priority, 0 being low priority
|
||||
*/
|
||||
public Long priority;
|
||||
/**
|
||||
* The class of the object this message is associated with
|
||||
*/
|
||||
public Types.Cls cls;
|
||||
/**
|
||||
* The uuid of the object this message is associated with
|
||||
*/
|
||||
public String objUuid;
|
||||
/**
|
||||
* The time at which the message was created
|
||||
*/
|
||||
public Date timestamp;
|
||||
/**
|
||||
* The body of the message
|
||||
*/
|
||||
public String body;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param name The name of the message
|
||||
* @param priority The priority of the message
|
||||
* @param cls The class of object this message is associated with
|
||||
* @param objUuid The uuid of the object this message is associated with
|
||||
* @param body The body of the message
|
||||
* @return The reference of the created message
|
||||
*/
|
||||
public static Message create(Connection c, String name, Long priority, Types.Cls cls, String objUuid, String body) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(priority), Marshalling.toXMLRPC(cls), Marshalling.toXMLRPC(objUuid), Marshalling.toXMLRPC(body)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMessage(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param cls The class of object
|
||||
* @param objUuid The uuid of the object
|
||||
* @param since The cutoff time
|
||||
* @return The relevant messages
|
||||
*/
|
||||
public static Map<Message, Message.Record> get(Connection c, Types.Cls cls, String objUuid, Date since) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.get";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(cls), Marshalling.toXMLRPC(objUuid), Marshalling.toXMLRPC(since)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfMessageMessageRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return The references to the messages
|
||||
*/
|
||||
public static Set<Message> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfMessage(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param since The cutoff time
|
||||
* @return The relevant messages
|
||||
*/
|
||||
public static Map<Message, Message.Record> getSince(Connection c, Date since) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.get_since";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(since)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfMessageMessageRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return The message record
|
||||
*/
|
||||
public Message.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMessageRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param uuid The uuid of the message
|
||||
* @return The message reference
|
||||
*/
|
||||
public static Message getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMessage(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return The messages
|
||||
*/
|
||||
public static Map<Message, Message.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfMessageMessageRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param expr The expression to match (not currently used)
|
||||
* @return The messages
|
||||
*/
|
||||
public static Map<Message, Message.Record> getAllRecordsWhere(Connection c, String expr) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "message.get_all_records_where";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(expr)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfMessageMessageRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,710 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A virtual network
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Network extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Network(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Network, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Network)
|
||||
{
|
||||
Network other = (Network) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Network
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "allowedOperations", this.allowedOperations);
|
||||
print.printf("%1$20s: %2$s\n", "currentOperations", this.currentOperations);
|
||||
print.printf("%1$20s: %2$s\n", "VIFs", this.VIFs);
|
||||
print.printf("%1$20s: %2$s\n", "PIFs", this.PIFs);
|
||||
print.printf("%1$20s: %2$s\n", "MTU", this.MTU);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
print.printf("%1$20s: %2$s\n", "bridge", this.bridge);
|
||||
print.printf("%1$20s: %2$s\n", "blobs", this.blobs);
|
||||
print.printf("%1$20s: %2$s\n", "tags", this.tags);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a network.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("allowed_operations", this.allowedOperations == null ? new LinkedHashSet<Types.NetworkOperations>() : this.allowedOperations);
|
||||
map.put("current_operations", this.currentOperations == null ? new HashMap<String, Types.NetworkOperations>() : this.currentOperations);
|
||||
map.put("VIFs", this.VIFs == null ? new LinkedHashSet<VIF>() : this.VIFs);
|
||||
map.put("PIFs", this.PIFs == null ? new LinkedHashSet<PIF>() : this.PIFs);
|
||||
map.put("MTU", this.MTU == null ? 0 : this.MTU);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
map.put("bridge", this.bridge == null ? "" : this.bridge);
|
||||
map.put("blobs", this.blobs == null ? new HashMap<String, Blob>() : this.blobs);
|
||||
map.put("tags", this.tags == null ? new LinkedHashSet<String>() : this.tags);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* a human-readable name
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* a notes field containg human-readable description
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* list of the operations allowed in this state. This list is advisory only and the server state may have changed by the time this field is read by a client.
|
||||
*/
|
||||
public Set<Types.NetworkOperations> allowedOperations;
|
||||
/**
|
||||
* links each of the running tasks using this object (by reference) to a current_operation enum which describes the nature of the task.
|
||||
*/
|
||||
public Map<String, Types.NetworkOperations> currentOperations;
|
||||
/**
|
||||
* list of connected vifs
|
||||
*/
|
||||
public Set<VIF> VIFs;
|
||||
/**
|
||||
* list of connected pifs
|
||||
*/
|
||||
public Set<PIF> PIFs;
|
||||
/**
|
||||
* MTU in octets
|
||||
*/
|
||||
public Long MTU;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
/**
|
||||
* name of the bridge corresponding to this network on the local host
|
||||
*/
|
||||
public String bridge;
|
||||
/**
|
||||
* Binary blobs associated with this network
|
||||
*/
|
||||
public Map<String, Blob> blobs;
|
||||
/**
|
||||
* user-specified tags for categorization purposes
|
||||
*/
|
||||
public Set<String> tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given network.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Network.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toNetworkRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the network instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Network getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toNetwork(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new network instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, Network.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.network.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new network instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
public static Network create(Connection c, Network.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toNetwork(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified network instance.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.network.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified network instance.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the network instances with the given label.
|
||||
*
|
||||
* @param label label of object to return
|
||||
* @return references to objects with matching names
|
||||
*/
|
||||
public static Set<Network> getByNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_by_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfNetwork(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/label field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/description field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameDescription(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the allowed_operations field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Types.NetworkOperations> getAllowedOperations(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_allowed_operations";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfNetworkOperations(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current_operations field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, Types.NetworkOperations> getCurrentOperations(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_current_operations";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringNetworkOperations(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VIFs field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<VIF> getVIFs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_VIFs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PIFs field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<PIF> getPIFs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_PIFs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfPIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MTU field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getMTU(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_MTU";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bridge field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getBridge(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_bridge";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the blobs field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, Blob> getBlobs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_blobs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringBlob(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tags field of the given network.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<String> getTags(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_tags";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name/label field of the given network.
|
||||
*
|
||||
* @param label New value to set
|
||||
*/
|
||||
public void setNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.set_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name/description field of the given network.
|
||||
*
|
||||
* @param description New value to set
|
||||
*/
|
||||
public void setNameDescription(Connection c, String description) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.set_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(description)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the MTU field of the given network.
|
||||
*
|
||||
* @param MTU New value to set
|
||||
*/
|
||||
public void setMTU(Connection c, Long MTU) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.set_MTU";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(MTU)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given network.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given network.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given network. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tags field of the given network.
|
||||
*
|
||||
* @param tags New value to set
|
||||
*/
|
||||
public void setTags(Connection c, Set<String> tags) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.set_tags";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(tags)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given value to the tags field of the given network. If the value is already in that Set, then do nothing.
|
||||
*
|
||||
* @param value New value to add
|
||||
*/
|
||||
public void addTags(Connection c, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.add_tags";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given value from the tags field of the given network. If the value is not in that Set, then do nothing.
|
||||
*
|
||||
* @param value Value to remove
|
||||
*/
|
||||
public void removeTags(Connection c, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.remove_tags";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a placeholder for a named binary blob of data that is associated with this pool
|
||||
*
|
||||
* @param name The name associated with the blob
|
||||
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
|
||||
* @return Task
|
||||
*/
|
||||
public Task createNewBlobAsync(Connection c, String name, String mimeType) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.network.create_new_blob";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a placeholder for a named binary blob of data that is associated with this pool
|
||||
*
|
||||
* @param name The name associated with the blob
|
||||
* @param mimeType The mime type for the data. Empty string translates to application/octet-stream
|
||||
* @return The reference of the blob, needed for populating its data
|
||||
*/
|
||||
public Blob createNewBlob(Connection c, String name, String mimeType) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.create_new_blob";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(name), Marshalling.toXMLRPC(mimeType)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBlob(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the networks known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Network> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfNetwork(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of network references to network records for all networks known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Network, Network.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "network.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfNetworkNetworkRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
520
deps/XenServerJava/src/com/xensource/xenapi/PBD.java
vendored
520
deps/XenServerJava/src/com/xensource/xenapi/PBD.java
vendored
@ -1,520 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* The physical block devices through which hosts access SRs
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class PBD extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
PBD(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a PBD, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof PBD)
|
||||
{
|
||||
PBD other = (PBD) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a PBD
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "host", this.host);
|
||||
print.printf("%1$20s: %2$s\n", "SR", this.SR);
|
||||
print.printf("%1$20s: %2$s\n", "deviceConfig", this.deviceConfig);
|
||||
print.printf("%1$20s: %2$s\n", "currentlyAttached", this.currentlyAttached);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a PBD.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("host", this.host == null ? new Host("OpaqueRef:NULL") : this.host);
|
||||
map.put("SR", this.SR == null ? new SR("OpaqueRef:NULL") : this.SR);
|
||||
map.put("device_config", this.deviceConfig == null ? new HashMap<String, String>() : this.deviceConfig);
|
||||
map.put("currently_attached", this.currentlyAttached == null ? false : this.currentlyAttached);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* physical machine on which the pbd is available
|
||||
*/
|
||||
public Host host;
|
||||
/**
|
||||
* the storage repository that the pbd realises
|
||||
*/
|
||||
public SR SR;
|
||||
/**
|
||||
* a config string to string map that is provided to the host's SR-backend-driver
|
||||
*/
|
||||
public Map<String, String> deviceConfig;
|
||||
/**
|
||||
* is the SR currently attached on this host?
|
||||
*/
|
||||
public Boolean currentlyAttached;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given PBD.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public PBD.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPBDRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the PBD instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static PBD getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPBD(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PBD instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, PBD.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.PBD.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PBD instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
public static PBD create(Connection c, PBD.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPBD(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified PBD instance.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.PBD.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified PBD instance.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given PBD.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host field of the given PBD.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Host getHost(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_host";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHost(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SR field of the given PBD.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public SR getSR(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_SR";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSR(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device_config field of the given PBD.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getDeviceConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_device_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently_attached field of the given PBD.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getCurrentlyAttached(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_currently_attached";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given PBD.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given PBD.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given PBD.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given PBD. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified PBD, causing the referenced SR to be attached and scanned
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task plugAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.SrUnknownDriver {
|
||||
String method_call = "Async.PBD.plug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified PBD, causing the referenced SR to be attached and scanned
|
||||
*
|
||||
*/
|
||||
public void plug(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.SrUnknownDriver {
|
||||
String method_call = "PBD.plug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate the specified PBD, causing the referenced SR to be detached and nolonger scanned
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task unplugAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.PBD.unplug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate the specified PBD, causing the referenced SR to be detached and nolonger scanned
|
||||
*
|
||||
*/
|
||||
public void unplug(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.unplug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the PBD's device_config field
|
||||
*
|
||||
* @param value The new value of the PBD's device_config
|
||||
* @return Task
|
||||
*/
|
||||
public Task setDeviceConfigAsync(Connection c, Map<String, String> value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.PBD.set_device_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the PBD's device_config field
|
||||
*
|
||||
* @param value The new value of the PBD's device_config
|
||||
*/
|
||||
public void setDeviceConfig(Connection c, Map<String, String> value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.set_device_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the PBDs known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<PBD> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfPBD(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of PBD references to PBD records for all PBDs known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<PBD, PBD.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PBD.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfPBDPBDRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
1214
deps/XenServerJava/src/com/xensource/xenapi/PIF.java
vendored
1214
deps/XenServerJava/src/com/xensource/xenapi/PIF.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,511 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* The metrics associated with a physical network interface
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class PIFMetrics extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
PIFMetrics(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a PIFMetrics, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof PIFMetrics)
|
||||
{
|
||||
PIFMetrics other = (PIFMetrics) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a PIFMetrics
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "ioReadKbs", this.ioReadKbs);
|
||||
print.printf("%1$20s: %2$s\n", "ioWriteKbs", this.ioWriteKbs);
|
||||
print.printf("%1$20s: %2$s\n", "carrier", this.carrier);
|
||||
print.printf("%1$20s: %2$s\n", "vendorId", this.vendorId);
|
||||
print.printf("%1$20s: %2$s\n", "vendorName", this.vendorName);
|
||||
print.printf("%1$20s: %2$s\n", "deviceId", this.deviceId);
|
||||
print.printf("%1$20s: %2$s\n", "deviceName", this.deviceName);
|
||||
print.printf("%1$20s: %2$s\n", "speed", this.speed);
|
||||
print.printf("%1$20s: %2$s\n", "duplex", this.duplex);
|
||||
print.printf("%1$20s: %2$s\n", "pciBusPath", this.pciBusPath);
|
||||
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a PIF_metrics.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("io_read_kbs", this.ioReadKbs == null ? 0.0 : this.ioReadKbs);
|
||||
map.put("io_write_kbs", this.ioWriteKbs == null ? 0.0 : this.ioWriteKbs);
|
||||
map.put("carrier", this.carrier == null ? false : this.carrier);
|
||||
map.put("vendor_id", this.vendorId == null ? "" : this.vendorId);
|
||||
map.put("vendor_name", this.vendorName == null ? "" : this.vendorName);
|
||||
map.put("device_id", this.deviceId == null ? "" : this.deviceId);
|
||||
map.put("device_name", this.deviceName == null ? "" : this.deviceName);
|
||||
map.put("speed", this.speed == null ? 0 : this.speed);
|
||||
map.put("duplex", this.duplex == null ? false : this.duplex);
|
||||
map.put("pci_bus_path", this.pciBusPath == null ? "" : this.pciBusPath);
|
||||
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* Read bandwidth (KiB/s)
|
||||
*/
|
||||
public Double ioReadKbs;
|
||||
/**
|
||||
* Write bandwidth (KiB/s)
|
||||
*/
|
||||
public Double ioWriteKbs;
|
||||
/**
|
||||
* Report if the PIF got a carrier or not
|
||||
*/
|
||||
public Boolean carrier;
|
||||
/**
|
||||
* Report vendor ID
|
||||
*/
|
||||
public String vendorId;
|
||||
/**
|
||||
* Report vendor name
|
||||
*/
|
||||
public String vendorName;
|
||||
/**
|
||||
* Report device ID
|
||||
*/
|
||||
public String deviceId;
|
||||
/**
|
||||
* Report device name
|
||||
*/
|
||||
public String deviceName;
|
||||
/**
|
||||
* Speed of the link (if available)
|
||||
*/
|
||||
public Long speed;
|
||||
/**
|
||||
* Full duplex capability of the link (if available)
|
||||
*/
|
||||
public Boolean duplex;
|
||||
/**
|
||||
* PCI bus path of the pif (if available)
|
||||
*/
|
||||
public String pciBusPath;
|
||||
/**
|
||||
* Time at which this information was last updated
|
||||
*/
|
||||
public Date lastUpdated;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given PIF_metrics.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public PIFMetrics.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPIFMetricsRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the PIF_metrics instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static PIFMetrics getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPIFMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the io/read_kbs field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getIoReadKbs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_io_read_kbs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the io/write_kbs field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getIoWriteKbs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_io_write_kbs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the carrier field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getCarrier(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_carrier";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vendor_id field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getVendorId(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_vendor_id";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vendor_name field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getVendorName(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_vendor_name";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device_id field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getDeviceId(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_device_id";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device_name field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getDeviceName(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_device_name";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the speed field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getSpeed(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_speed";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duplex field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getDuplex(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_duplex";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pci_bus_path field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getPciBusPath(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_pci_bus_path";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_updated field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastUpdated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_last_updated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given PIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given PIF_metrics.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given PIF_metrics.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given PIF_metrics. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the PIF_metrics instances known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<PIFMetrics> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfPIFMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of PIF_metrics references to PIF_metrics records for all PIF_metrics instances known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<PIFMetrics, PIFMetrics.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "PIF_metrics.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfPIFMetricsPIFMetricsRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
2277
deps/XenServerJava/src/com/xensource/xenapi/Pool.java
vendored
2277
deps/XenServerJava/src/com/xensource/xenapi/Pool.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,605 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* Pool-wide patches
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class PoolPatch extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
PoolPatch(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a PoolPatch, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof PoolPatch)
|
||||
{
|
||||
PoolPatch other = (PoolPatch) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a PoolPatch
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "version", this.version);
|
||||
print.printf("%1$20s: %2$s\n", "size", this.size);
|
||||
print.printf("%1$20s: %2$s\n", "poolApplied", this.poolApplied);
|
||||
print.printf("%1$20s: %2$s\n", "hostPatches", this.hostPatches);
|
||||
print.printf("%1$20s: %2$s\n", "afterApplyGuidance", this.afterApplyGuidance);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a pool_patch.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("version", this.version == null ? "" : this.version);
|
||||
map.put("size", this.size == null ? 0 : this.size);
|
||||
map.put("pool_applied", this.poolApplied == null ? false : this.poolApplied);
|
||||
map.put("host_patches", this.hostPatches == null ? new LinkedHashSet<HostPatch>() : this.hostPatches);
|
||||
map.put("after_apply_guidance", this.afterApplyGuidance == null ? new LinkedHashSet<Types.AfterApplyGuidance>() : this.afterApplyGuidance);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* a human-readable name
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* a notes field containg human-readable description
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* Patch version number
|
||||
*/
|
||||
public String version;
|
||||
/**
|
||||
* Size of the patch
|
||||
*/
|
||||
public Long size;
|
||||
/**
|
||||
* This patch should be applied across the entire pool
|
||||
*/
|
||||
public Boolean poolApplied;
|
||||
/**
|
||||
* This hosts this patch is applied to.
|
||||
*/
|
||||
public Set<HostPatch> hostPatches;
|
||||
/**
|
||||
* What the client should do after this patch has been applied.
|
||||
*/
|
||||
public Set<Types.AfterApplyGuidance> afterApplyGuidance;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given pool_patch.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public PoolPatch.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPoolPatchRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the pool_patch instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static PoolPatch getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPoolPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the pool_patch instances with the given label.
|
||||
*
|
||||
* @param label label of object to return
|
||||
* @return references to objects with matching names
|
||||
*/
|
||||
public static Set<PoolPatch> getByNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_by_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfPoolPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/label field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/description field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameDescription(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getVersion(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_version";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getSize(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_size";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pool_applied field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getPoolApplied(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_pool_applied";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host_patches field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<HostPatch> getHostPatches(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_host_patches";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfHostPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the after_apply_guidance field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Types.AfterApplyGuidance> getAfterApplyGuidance(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_after_apply_guidance";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfAfterApplyGuidance(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given pool_patch.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given pool_patch.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given pool_patch.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given pool_patch. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the selected patch to a host and return its output
|
||||
*
|
||||
* @param host The host to apply the patch too
|
||||
* @return Task
|
||||
*/
|
||||
public Task applyAsync(Connection c, Host host) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.pool_patch.apply";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the selected patch to a host and return its output
|
||||
*
|
||||
* @param host The host to apply the patch too
|
||||
* @return the output of the patch application process
|
||||
*/
|
||||
public String apply(Connection c, Host host) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.apply";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the selected patch to all hosts in the pool and return a map of host_ref -> patch output
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task poolApplyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.pool_patch.pool_apply";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the selected patch to all hosts in the pool and return a map of host_ref -> patch output
|
||||
*
|
||||
*/
|
||||
public void poolApply(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.pool_apply";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the precheck stage of the selected patch on a host and return its output
|
||||
*
|
||||
* @param host The host to run the prechecks on
|
||||
* @return Task
|
||||
*/
|
||||
public Task precheckAsync(Connection c, Host host) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.pool_patch.precheck";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the precheck stage of the selected patch on a host and return its output
|
||||
*
|
||||
* @param host The host to run the prechecks on
|
||||
* @return the output of the patch prechecks
|
||||
*/
|
||||
public String precheck(Connection c, Host host) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.precheck";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(host)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the patch's files from all hosts in the pool, but does not remove the database entries
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task cleanAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.pool_patch.clean";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the patch's files from all hosts in the pool, but does not remove the database entries
|
||||
*
|
||||
*/
|
||||
public void clean(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.clean";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the patch's files from all hosts in the pool, and removes the database entries. Only works on unapplied patches.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.pool_patch.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the patch's files from all hosts in the pool, and removes the database entries. Only works on unapplied patches.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the pool_patchs known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<PoolPatch> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfPoolPatch(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of pool_patch references to pool_patch records for all pool_patchs known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<PoolPatch, PoolPatch.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "pool_patch.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfPoolPatchPoolPatchRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,342 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A set of permissions associated with a subject
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Role extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Role(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Role, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Role)
|
||||
{
|
||||
Role other = (Role) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Role
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "subroles", this.subroles);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a role.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("subroles", this.subroles == null ? new LinkedHashSet<Role>() : this.subroles);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* a short user-friendly name for the role
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* what this role is for
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* a list of pointers to other roles or permissions
|
||||
*/
|
||||
public Set<Role> subroles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given role.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Role.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toRoleRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the role instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Role getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the role instances with the given label.
|
||||
*
|
||||
* @param label label of object to return
|
||||
* @return references to objects with matching names
|
||||
*/
|
||||
public static Set<Role> getByNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_by_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given role.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/label field of the given role.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/description field of the given role.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameDescription(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subroles field of the given role.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Role> getSubroles(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_subroles";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This call returns a list of permissions given a role
|
||||
*
|
||||
* @return a list of permissions
|
||||
*/
|
||||
public Set<Role> getPermissions(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_permissions";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This call returns a list of permission names given a role
|
||||
*
|
||||
* @return a list of permission names
|
||||
*/
|
||||
public Set<String> getPermissionsNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_permissions_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This call returns a list of roles given a permission
|
||||
*
|
||||
* @return a list of references to roles
|
||||
*/
|
||||
public Set<Role> getByPermission(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_by_permission";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This call returns a list of roles given a permission name
|
||||
*
|
||||
* @param label The short friendly name of the role
|
||||
* @return a list of references to roles
|
||||
*/
|
||||
public static Set<Role> getByPermissionNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_by_permission_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the roles known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Role> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of role references to role records for all roles known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Role, Role.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "role.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfRoleRoleRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
506
deps/XenServerJava/src/com/xensource/xenapi/SM.java
vendored
506
deps/XenServerJava/src/com/xensource/xenapi/SM.java
vendored
@ -1,506 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A storage manager plugin
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class SM extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
SM(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a SM, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof SM)
|
||||
{
|
||||
SM other = (SM) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a SM
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "type", this.type);
|
||||
print.printf("%1$20s: %2$s\n", "vendor", this.vendor);
|
||||
print.printf("%1$20s: %2$s\n", "copyright", this.copyright);
|
||||
print.printf("%1$20s: %2$s\n", "version", this.version);
|
||||
print.printf("%1$20s: %2$s\n", "requiredApiVersion", this.requiredApiVersion);
|
||||
print.printf("%1$20s: %2$s\n", "configuration", this.configuration);
|
||||
print.printf("%1$20s: %2$s\n", "capabilities", this.capabilities);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
print.printf("%1$20s: %2$s\n", "driverFilename", this.driverFilename);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a SM.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("type", this.type == null ? "" : this.type);
|
||||
map.put("vendor", this.vendor == null ? "" : this.vendor);
|
||||
map.put("copyright", this.copyright == null ? "" : this.copyright);
|
||||
map.put("version", this.version == null ? "" : this.version);
|
||||
map.put("required_api_version", this.requiredApiVersion == null ? "" : this.requiredApiVersion);
|
||||
map.put("configuration", this.configuration == null ? new HashMap<String, String>() : this.configuration);
|
||||
map.put("capabilities", this.capabilities == null ? new LinkedHashSet<String>() : this.capabilities);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
map.put("driver_filename", this.driverFilename == null ? "" : this.driverFilename);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* a human-readable name
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* a notes field containg human-readable description
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* SR.type
|
||||
*/
|
||||
public String type;
|
||||
/**
|
||||
* Vendor who created this plugin
|
||||
*/
|
||||
public String vendor;
|
||||
/**
|
||||
* Entity which owns the copyright of this plugin
|
||||
*/
|
||||
public String copyright;
|
||||
/**
|
||||
* Version of the plugin
|
||||
*/
|
||||
public String version;
|
||||
/**
|
||||
* Minimum SM API version required on the server
|
||||
*/
|
||||
public String requiredApiVersion;
|
||||
/**
|
||||
* names and descriptions of device config keys
|
||||
*/
|
||||
public Map<String, String> configuration;
|
||||
/**
|
||||
* capabilities of the SM plugin
|
||||
*/
|
||||
public Set<String> capabilities;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
/**
|
||||
* filename of the storage driver
|
||||
*/
|
||||
public String driverFilename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given SM.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public SM.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSMRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the SM instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static SM getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the SM instances with the given label.
|
||||
*
|
||||
* @param label label of object to return
|
||||
* @return references to objects with matching names
|
||||
*/
|
||||
public static Set<SM> getByNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_by_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfSM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/label field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/description field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameDescription(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getType(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_type";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vendor field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getVendor(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_vendor";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the copyright field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getCopyright(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_copyright";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getVersion(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_version";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the required_api_version field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getRequiredApiVersion(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_required_api_version";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getConfiguration(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_configuration";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the capabilities field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<String> getCapabilities(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_capabilities";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the driver_filename field of the given SM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getDriverFilename(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_driver_filename";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given SM.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given SM.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given SM. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the SMs known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<SM> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfSM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of SM references to SM records for all SMs known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<SM, SM.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "SM.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfSMSMRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
1460
deps/XenServerJava/src/com/xensource/xenapi/SR.java
vendored
1460
deps/XenServerJava/src/com/xensource/xenapi/SR.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,295 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A secret
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Secret extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Secret(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Secret, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Secret)
|
||||
{
|
||||
Secret other = (Secret) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Secret
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "value", this.value);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a secret.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("value", this.value == null ? "" : this.value);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* the secret
|
||||
*/
|
||||
public String value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given secret.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Secret.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSecretRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the secret instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Secret getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSecret(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new secret instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, Secret.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.secret.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new secret instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
public static Secret create(Connection c, Secret.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSecret(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified secret instance.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.secret.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified secret instance.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given secret.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value field of the given secret.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getValue(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.get_value";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value field of the given secret.
|
||||
*
|
||||
* @param value New value to set
|
||||
*/
|
||||
public void setValue(Connection c, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.set_value";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the secrets known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Secret> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfSecret(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of secret references to secret records for all secrets known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Secret, Secret.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "secret.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfSecretSecretRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,653 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A session
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Session extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Session(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Session, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Session)
|
||||
{
|
||||
Session other = (Session) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Session
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "thisHost", this.thisHost);
|
||||
print.printf("%1$20s: %2$s\n", "thisUser", this.thisUser);
|
||||
print.printf("%1$20s: %2$s\n", "lastActive", this.lastActive);
|
||||
print.printf("%1$20s: %2$s\n", "pool", this.pool);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
print.printf("%1$20s: %2$s\n", "isLocalSuperuser", this.isLocalSuperuser);
|
||||
print.printf("%1$20s: %2$s\n", "subject", this.subject);
|
||||
print.printf("%1$20s: %2$s\n", "validationTime", this.validationTime);
|
||||
print.printf("%1$20s: %2$s\n", "authUserSid", this.authUserSid);
|
||||
print.printf("%1$20s: %2$s\n", "authUserName", this.authUserName);
|
||||
print.printf("%1$20s: %2$s\n", "rbacPermissions", this.rbacPermissions);
|
||||
print.printf("%1$20s: %2$s\n", "tasks", this.tasks);
|
||||
print.printf("%1$20s: %2$s\n", "parent", this.parent);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a session.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("this_host", this.thisHost == null ? new Host("OpaqueRef:NULL") : this.thisHost);
|
||||
map.put("this_user", this.thisUser == null ? new User("OpaqueRef:NULL") : this.thisUser);
|
||||
map.put("last_active", this.lastActive == null ? new Date(0) : this.lastActive);
|
||||
map.put("pool", this.pool == null ? false : this.pool);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
map.put("is_local_superuser", this.isLocalSuperuser == null ? false : this.isLocalSuperuser);
|
||||
map.put("subject", this.subject == null ? new Subject("OpaqueRef:NULL") : this.subject);
|
||||
map.put("validation_time", this.validationTime == null ? new Date(0) : this.validationTime);
|
||||
map.put("auth_user_sid", this.authUserSid == null ? "" : this.authUserSid);
|
||||
map.put("auth_user_name", this.authUserName == null ? "" : this.authUserName);
|
||||
map.put("rbac_permissions", this.rbacPermissions == null ? new LinkedHashSet<String>() : this.rbacPermissions);
|
||||
map.put("tasks", this.tasks == null ? new LinkedHashSet<Task>() : this.tasks);
|
||||
map.put("parent", this.parent == null ? new Session("OpaqueRef:NULL") : this.parent);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* Currently connected host
|
||||
*/
|
||||
public Host thisHost;
|
||||
/**
|
||||
* Currently connected user
|
||||
*/
|
||||
public User thisUser;
|
||||
/**
|
||||
* Timestamp for last time session was active
|
||||
*/
|
||||
public Date lastActive;
|
||||
/**
|
||||
* True if this session relates to a intra-pool login, false otherwise
|
||||
*/
|
||||
public Boolean pool;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
/**
|
||||
* true iff this session was created using local superuser credentials
|
||||
*/
|
||||
public Boolean isLocalSuperuser;
|
||||
/**
|
||||
* references the subject instance that created the session. If a session instance has is_local_superuser set, then the value of this field is undefined.
|
||||
*/
|
||||
public Subject subject;
|
||||
/**
|
||||
* time when session was last validated
|
||||
*/
|
||||
public Date validationTime;
|
||||
/**
|
||||
* the subject identifier of the user that was externally authenticated. If a session instance has is_local_superuser set, then the value of this field is undefined.
|
||||
*/
|
||||
public String authUserSid;
|
||||
/**
|
||||
* the subject name of the user that was externally authenticated. If a session instance has is_local_superuser set, then the value of this field is undefined.
|
||||
*/
|
||||
public String authUserName;
|
||||
/**
|
||||
* list with all RBAC permissions for this session
|
||||
*/
|
||||
public Set<String> rbacPermissions;
|
||||
/**
|
||||
* list of tasks created using the current session
|
||||
*/
|
||||
public Set<Task> tasks;
|
||||
/**
|
||||
* references the parent session that created this session
|
||||
*/
|
||||
public Session parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given session.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Session.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSessionRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the session instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Session getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSession(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the this_host field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Host getThisHost(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_this_host";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHost(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the this_user field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public User getThisUser(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_this_user";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toUser(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_active field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastActive(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_last_active";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pool field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getPool(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_pool";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the is_local_superuser field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getIsLocalSuperuser(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_is_local_superuser";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subject field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Subject getSubject(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_subject";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSubject(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation_time field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getValidationTime(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_validation_time";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the auth_user_sid field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getAuthUserSid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_auth_user_sid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the auth_user_name field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getAuthUserName(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_auth_user_name";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rbac_permissions field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<String> getRbacPermissions(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_rbac_permissions";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tasks field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Task> getTasks(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_tasks";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent field of the given session.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Session getParent(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_parent";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSession(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given session.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given session.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given session. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to authenticate the user, returning a session reference if successful
|
||||
*
|
||||
* @param uname Username for login.
|
||||
* @param pwd Password for login.
|
||||
* @param version Client API version.
|
||||
* @return reference of newly created session
|
||||
*/
|
||||
public static Session loginWithPassword(Connection c, String uname, String pwd, String version) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.SessionAuthenticationFailed {
|
||||
String method_call = "session.login_with_password";
|
||||
Object[] method_params = {Marshalling.toXMLRPC(uname), Marshalling.toXMLRPC(pwd), Marshalling.toXMLRPC(version)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSession(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of a session
|
||||
*
|
||||
*/
|
||||
public static void logout(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.logout";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the account password; if your session is authenticated with root priviledges then the old_pwd is validated and the new_pwd is set regardless
|
||||
*
|
||||
* @param oldPwd Old password for account
|
||||
* @param newPwd New password for account
|
||||
*/
|
||||
public static void changePassword(Connection c, String oldPwd, String newPwd) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.change_password";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(oldPwd), Marshalling.toXMLRPC(newPwd)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate locally against a slave in emergency mode. Note the resulting sessions are only good for use on this host.
|
||||
*
|
||||
* @param uname Username for login.
|
||||
* @param pwd Password for login.
|
||||
* @return ID of newly created session
|
||||
*/
|
||||
public static Session slaveLocalLoginWithPassword(Connection c, String uname, String pwd) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.slave_local_login_with_password";
|
||||
Object[] method_params = {Marshalling.toXMLRPC(uname), Marshalling.toXMLRPC(pwd)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSession(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of local session.
|
||||
*
|
||||
*/
|
||||
public static void localLogout(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.local_logout";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the user subject-identifiers of all existing sessions
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public static Task getAllSubjectIdentifiersAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.session.get_all_subject_identifiers";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the user subject-identifiers of all existing sessions
|
||||
*
|
||||
* @return The list of user subject-identifiers of all existing sessions
|
||||
*/
|
||||
public static Set<String> getAllSubjectIdentifiers(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.get_all_subject_identifiers";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function
|
||||
*
|
||||
* @param subjectIdentifier User subject-identifier of the sessions to be destroyed
|
||||
* @return Task
|
||||
*/
|
||||
public static Task logoutSubjectIdentifierAsync(Connection c, String subjectIdentifier) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.session.logout_subject_identifier";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function
|
||||
*
|
||||
* @param subjectIdentifier User subject-identifier of the sessions to be destroyed
|
||||
*/
|
||||
public static void logoutSubjectIdentifier(Connection c, String subjectIdentifier) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "session.logout_subject_identifier";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,374 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A user or group that can log in xapi
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Subject extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Subject(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Subject, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Subject)
|
||||
{
|
||||
Subject other = (Subject) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Subject
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "subjectIdentifier", this.subjectIdentifier);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
print.printf("%1$20s: %2$s\n", "roles", this.roles);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a subject.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("subject_identifier", this.subjectIdentifier == null ? "" : this.subjectIdentifier);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
map.put("roles", this.roles == null ? new LinkedHashSet<Role>() : this.roles);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* the subject identifier, unique in the external directory service
|
||||
*/
|
||||
public String subjectIdentifier;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
/**
|
||||
* the roles associated with this subject
|
||||
*/
|
||||
public Set<Role> roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given subject.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Subject.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSubjectRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the subject instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Subject getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSubject(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subject instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, Subject.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.subject.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subject instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
public static Subject create(Connection c, Subject.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSubject(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified subject instance.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.subject.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified subject instance.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given subject.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subject_identifier field of the given subject.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getSubjectIdentifier(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_subject_identifier";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given subject.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the roles field of the given subject.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Role> getRoles(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_roles";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfRole(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This call adds a new role to a subject
|
||||
*
|
||||
* @param role The unique role reference
|
||||
*/
|
||||
public void addToRoles(Connection c, Role role) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.add_to_roles";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(role)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This call removes a role from a subject
|
||||
*
|
||||
* @param role The unique role reference in the subject's roles field
|
||||
*/
|
||||
public void removeFromRoles(Connection c, Role role) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.remove_from_roles";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(role)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This call returns a list of permission names given a subject
|
||||
*
|
||||
* @return a list of permission names
|
||||
*/
|
||||
public Set<String> getPermissionsNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_permissions_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the subjects known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Subject> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfSubject(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of subject references to subject records for all subjects known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Subject, Subject.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "subject.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfSubjectSubjectRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,666 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A long-running asynchronous task
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Task extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Task(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Task, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Task)
|
||||
{
|
||||
Task other = (Task) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Task
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "nameLabel", this.nameLabel);
|
||||
print.printf("%1$20s: %2$s\n", "nameDescription", this.nameDescription);
|
||||
print.printf("%1$20s: %2$s\n", "allowedOperations", this.allowedOperations);
|
||||
print.printf("%1$20s: %2$s\n", "currentOperations", this.currentOperations);
|
||||
print.printf("%1$20s: %2$s\n", "created", this.created);
|
||||
print.printf("%1$20s: %2$s\n", "finished", this.finished);
|
||||
print.printf("%1$20s: %2$s\n", "status", this.status);
|
||||
print.printf("%1$20s: %2$s\n", "residentOn", this.residentOn);
|
||||
print.printf("%1$20s: %2$s\n", "progress", this.progress);
|
||||
print.printf("%1$20s: %2$s\n", "type", this.type);
|
||||
print.printf("%1$20s: %2$s\n", "result", this.result);
|
||||
print.printf("%1$20s: %2$s\n", "errorInfo", this.errorInfo);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
print.printf("%1$20s: %2$s\n", "subtaskOf", this.subtaskOf);
|
||||
print.printf("%1$20s: %2$s\n", "subtasks", this.subtasks);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a task.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("name_label", this.nameLabel == null ? "" : this.nameLabel);
|
||||
map.put("name_description", this.nameDescription == null ? "" : this.nameDescription);
|
||||
map.put("allowed_operations", this.allowedOperations == null ? new LinkedHashSet<Types.TaskAllowedOperations>() : this.allowedOperations);
|
||||
map.put("current_operations", this.currentOperations == null ? new HashMap<String, Types.TaskAllowedOperations>() : this.currentOperations);
|
||||
map.put("created", this.created == null ? new Date(0) : this.created);
|
||||
map.put("finished", this.finished == null ? new Date(0) : this.finished);
|
||||
map.put("status", this.status == null ? Types.TaskStatusType.UNRECOGNIZED : this.status);
|
||||
map.put("resident_on", this.residentOn == null ? new Host("OpaqueRef:NULL") : this.residentOn);
|
||||
map.put("progress", this.progress == null ? 0.0 : this.progress);
|
||||
map.put("type", this.type == null ? "" : this.type);
|
||||
map.put("result", this.result == null ? "" : this.result);
|
||||
map.put("error_info", this.errorInfo == null ? new LinkedHashSet<String>() : this.errorInfo);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
map.put("subtask_of", this.subtaskOf == null ? new Task("OpaqueRef:NULL") : this.subtaskOf);
|
||||
map.put("subtasks", this.subtasks == null ? new LinkedHashSet<Task>() : this.subtasks);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* a human-readable name
|
||||
*/
|
||||
public String nameLabel;
|
||||
/**
|
||||
* a notes field containg human-readable description
|
||||
*/
|
||||
public String nameDescription;
|
||||
/**
|
||||
* list of the operations allowed in this state. This list is advisory only and the server state may have changed by the time this field is read by a client.
|
||||
*/
|
||||
public Set<Types.TaskAllowedOperations> allowedOperations;
|
||||
/**
|
||||
* links each of the running tasks using this object (by reference) to a current_operation enum which describes the nature of the task.
|
||||
*/
|
||||
public Map<String, Types.TaskAllowedOperations> currentOperations;
|
||||
/**
|
||||
* Time task was created
|
||||
*/
|
||||
public Date created;
|
||||
/**
|
||||
* Time task finished (i.e. succeeded or failed). If task-status is pending, then the value of this field has no meaning
|
||||
*/
|
||||
public Date finished;
|
||||
/**
|
||||
* current status of the task
|
||||
*/
|
||||
public Types.TaskStatusType status;
|
||||
/**
|
||||
* the host on which the task is running
|
||||
*/
|
||||
public Host residentOn;
|
||||
/**
|
||||
* if the task is still pending, this field contains the estimated fraction complete (0.-1.). If task has completed (successfully or unsuccessfully) this should be 1.
|
||||
*/
|
||||
public Double progress;
|
||||
/**
|
||||
* if the task has completed successfully, this field contains the type of the encoded result (i.e. name of the class whose reference is in the result field). Undefined otherwise.
|
||||
*/
|
||||
public String type;
|
||||
/**
|
||||
* if the task has completed successfully, this field contains the result value (either Void or an object reference). Undefined otherwise.
|
||||
*/
|
||||
public String result;
|
||||
/**
|
||||
* if the task has failed, this field contains the set of associated error strings. Undefined otherwise.
|
||||
*/
|
||||
public Set<String> errorInfo;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
/**
|
||||
* Ref pointing to the task this is a substask of.
|
||||
*/
|
||||
public Task subtaskOf;
|
||||
/**
|
||||
* List pointing to all the substasks.
|
||||
*/
|
||||
public Set<Task> subtasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given task.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Task.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTaskRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the task instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Task getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the task instances with the given label.
|
||||
*
|
||||
* @param label label of object to return
|
||||
* @return references to objects with matching names
|
||||
*/
|
||||
public static Set<Task> getByNameLabel(Connection c, String label) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_by_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/label field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameLabel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_name_label";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name/description field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getNameDescription(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_name_description";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the allowed_operations field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Types.TaskAllowedOperations> getAllowedOperations(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_allowed_operations";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfTaskAllowedOperations(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current_operations field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, Types.TaskAllowedOperations> getCurrentOperations(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_current_operations";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringTaskAllowedOperations(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the created field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getCreated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_created";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the finished field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getFinished(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_finished";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Types.TaskStatusType getStatus(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_status";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTaskStatusType(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resident_on field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Host getResidentOn(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_resident_on";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toHost(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the progress field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getProgress(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_progress";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getType(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_type";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the result field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getResult(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_result";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error_info field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<String> getErrorInfo(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_error_info";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subtask_of field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Task getSubtaskOf(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_subtask_of";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subtasks field of the given task.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Task> getSubtasks(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_subtasks";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given task.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given task.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given task. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new task object which must be manually destroyed.
|
||||
*
|
||||
* @param label short label for the new task
|
||||
* @param description longer description for the new task
|
||||
* @return The reference of the created task object
|
||||
*/
|
||||
public static Task create(Connection c, String label, String description) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(label), Marshalling.toXMLRPC(description)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the task object
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task cancelAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.OperationNotAllowed {
|
||||
String method_call = "Async.task.cancel";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time.
|
||||
*
|
||||
*/
|
||||
public void cancel(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.OperationNotAllowed {
|
||||
String method_call = "task.cancel";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the tasks known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Task> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of task references to task records for all tasks known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Task, Task.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "task.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfTaskTaskRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,452 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A tunnel for network traffic
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class Tunnel extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
Tunnel(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a Tunnel, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof Tunnel)
|
||||
{
|
||||
Tunnel other = (Tunnel) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a Tunnel
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "accessPIF", this.accessPIF);
|
||||
print.printf("%1$20s: %2$s\n", "transportPIF", this.transportPIF);
|
||||
print.printf("%1$20s: %2$s\n", "status", this.status);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a tunnel.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("access_PIF", this.accessPIF == null ? new PIF("OpaqueRef:NULL") : this.accessPIF);
|
||||
map.put("transport_PIF", this.transportPIF == null ? new PIF("OpaqueRef:NULL") : this.transportPIF);
|
||||
map.put("status", this.status == null ? new HashMap<String, String>() : this.status);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* The interface through which the tunnel is accessed
|
||||
*/
|
||||
public PIF accessPIF;
|
||||
/**
|
||||
* The interface used by the tunnel
|
||||
*/
|
||||
public PIF transportPIF;
|
||||
/**
|
||||
* Status information about the tunnel
|
||||
*/
|
||||
public Map<String, String> status;
|
||||
/**
|
||||
* Additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given tunnel.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public Tunnel.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTunnelRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the tunnel instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static Tunnel getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTunnel(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given tunnel.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the access_PIF field of the given tunnel.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public PIF getAccessPIF(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_access_PIF";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transport_PIF field of the given tunnel.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public PIF getTransportPIF(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_transport_PIF";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status field of the given tunnel.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getStatus(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_status";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given tunnel.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the status field of the given tunnel.
|
||||
*
|
||||
* @param status New value to set
|
||||
*/
|
||||
public void setStatus(Connection c, Map<String, String> status) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.set_status";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(status)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the status field of the given tunnel.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToStatus(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.add_to_status";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the status field of the given tunnel. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromStatus(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.remove_from_status";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given tunnel.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given tunnel.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given tunnel. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a tunnel
|
||||
*
|
||||
* @param transportPIF PIF which receives the tagged traffic
|
||||
* @param network Network to receive the tunnelled traffic
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, PIF transportPIF, Network network) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.OpenvswitchNotActive,
|
||||
Types.TransportPifNotConfigured,
|
||||
Types.IsTunnelAccessPif {
|
||||
String method_call = "Async.tunnel.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(transportPIF), Marshalling.toXMLRPC(network)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a tunnel
|
||||
*
|
||||
* @param transportPIF PIF which receives the tagged traffic
|
||||
* @param network Network to receive the tunnelled traffic
|
||||
* @return The reference of the created tunnel object
|
||||
*/
|
||||
public static Tunnel create(Connection c, PIF transportPIF, Network network) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException,
|
||||
Types.OpenvswitchNotActive,
|
||||
Types.TransportPifNotConfigured,
|
||||
Types.IsTunnelAccessPif {
|
||||
String method_call = "tunnel.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(transportPIF), Marshalling.toXMLRPC(network)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTunnel(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a tunnel
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.tunnel.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a tunnel
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the tunnels known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<Tunnel> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfTunnel(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of tunnel references to tunnel records for all tunnels known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<Tunnel, Tunnel.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "tunnel.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfTunnelTunnelRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
11056
deps/XenServerJava/src/com/xensource/xenapi/Types.java
vendored
11056
deps/XenServerJava/src/com/xensource/xenapi/Types.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,362 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A user of the system
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class User extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
User(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a User, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof User)
|
||||
{
|
||||
User other = (User) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a User
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "shortName", this.shortName);
|
||||
print.printf("%1$20s: %2$s\n", "fullname", this.fullname);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a user.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("short_name", this.shortName == null ? "" : this.shortName);
|
||||
map.put("fullname", this.fullname == null ? "" : this.fullname);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* short name (e.g. userid)
|
||||
*/
|
||||
public String shortName;
|
||||
/**
|
||||
* full name
|
||||
*/
|
||||
public String fullname;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given user.
|
||||
* @deprecated
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
@Deprecated public User.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toUserRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the user instance with the specified UUID.
|
||||
* @deprecated
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
@Deprecated public static User getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toUser(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance, and return its handle.
|
||||
* @deprecated
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
@Deprecated public static Task createAsync(Connection c, User.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.user.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance, and return its handle.
|
||||
* @deprecated
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
@Deprecated public static User create(Connection c, User.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toUser(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified user instance.
|
||||
* @deprecated
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
@Deprecated public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.user.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified user instance.
|
||||
* @deprecated
|
||||
*
|
||||
*/
|
||||
@Deprecated public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given user.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the short_name field of the given user.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getShortName(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.get_short_name";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fullname field of the given user.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getFullname(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.get_fullname";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given user.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fullname field of the given user.
|
||||
*
|
||||
* @param fullname New value to set
|
||||
*/
|
||||
public void setFullname(Connection c, String fullname) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.set_fullname";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(fullname)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given user.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given user.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given user. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "user.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
1139
deps/XenServerJava/src/com/xensource/xenapi/VBD.java
vendored
1139
deps/XenServerJava/src/com/xensource/xenapi/VBD.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,327 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* The metrics associated with a virtual block device
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class VBDMetrics extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
VBDMetrics(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a VBDMetrics, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof VBDMetrics)
|
||||
{
|
||||
VBDMetrics other = (VBDMetrics) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a VBDMetrics
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "ioReadKbs", this.ioReadKbs);
|
||||
print.printf("%1$20s: %2$s\n", "ioWriteKbs", this.ioWriteKbs);
|
||||
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a VBD_metrics.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("io_read_kbs", this.ioReadKbs == null ? 0.0 : this.ioReadKbs);
|
||||
map.put("io_write_kbs", this.ioWriteKbs == null ? 0.0 : this.ioWriteKbs);
|
||||
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* Read bandwidth (KiB/s)
|
||||
*/
|
||||
public Double ioReadKbs;
|
||||
/**
|
||||
* Write bandwidth (KiB/s)
|
||||
*/
|
||||
public Double ioWriteKbs;
|
||||
/**
|
||||
* Time at which this information was last updated
|
||||
*/
|
||||
public Date lastUpdated;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given VBD_metrics.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public VBDMetrics.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVBDMetricsRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the VBD_metrics instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static VBDMetrics getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVBDMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given VBD_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the io/read_kbs field of the given VBD_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getIoReadKbs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_io_read_kbs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the io/write_kbs field of the given VBD_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getIoWriteKbs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_io_write_kbs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_updated field of the given VBD_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastUpdated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_last_updated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given VBD_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given VBD_metrics.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given VBD_metrics.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given VBD_metrics. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the VBD_metrics instances known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<VBDMetrics> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVBDMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of VBD_metrics references to VBD_metrics records for all VBD_metrics instances known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<VBDMetrics, VBDMetrics.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VBD_metrics.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfVBDMetricsVBDMetricsRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
1730
deps/XenServerJava/src/com/xensource/xenapi/VDI.java
vendored
1730
deps/XenServerJava/src/com/xensource/xenapi/VDI.java
vendored
File diff suppressed because it is too large
Load Diff
825
deps/XenServerJava/src/com/xensource/xenapi/VIF.java
vendored
825
deps/XenServerJava/src/com/xensource/xenapi/VIF.java
vendored
@ -1,825 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A virtual network interface
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class VIF extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
VIF(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a VIF, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof VIF)
|
||||
{
|
||||
VIF other = (VIF) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a VIF
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "allowedOperations", this.allowedOperations);
|
||||
print.printf("%1$20s: %2$s\n", "currentOperations", this.currentOperations);
|
||||
print.printf("%1$20s: %2$s\n", "device", this.device);
|
||||
print.printf("%1$20s: %2$s\n", "network", this.network);
|
||||
print.printf("%1$20s: %2$s\n", "VM", this.VM);
|
||||
print.printf("%1$20s: %2$s\n", "MAC", this.MAC);
|
||||
print.printf("%1$20s: %2$s\n", "MTU", this.MTU);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
print.printf("%1$20s: %2$s\n", "currentlyAttached", this.currentlyAttached);
|
||||
print.printf("%1$20s: %2$s\n", "statusCode", this.statusCode);
|
||||
print.printf("%1$20s: %2$s\n", "statusDetail", this.statusDetail);
|
||||
print.printf("%1$20s: %2$s\n", "runtimeProperties", this.runtimeProperties);
|
||||
print.printf("%1$20s: %2$s\n", "qosAlgorithmType", this.qosAlgorithmType);
|
||||
print.printf("%1$20s: %2$s\n", "qosAlgorithmParams", this.qosAlgorithmParams);
|
||||
print.printf("%1$20s: %2$s\n", "qosSupportedAlgorithms", this.qosSupportedAlgorithms);
|
||||
print.printf("%1$20s: %2$s\n", "metrics", this.metrics);
|
||||
print.printf("%1$20s: %2$s\n", "MACAutogenerated", this.MACAutogenerated);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a VIF.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("allowed_operations", this.allowedOperations == null ? new LinkedHashSet<Types.VifOperations>() : this.allowedOperations);
|
||||
map.put("current_operations", this.currentOperations == null ? new HashMap<String, Types.VifOperations>() : this.currentOperations);
|
||||
map.put("device", this.device == null ? "" : this.device);
|
||||
map.put("network", this.network == null ? new Network("OpaqueRef:NULL") : this.network);
|
||||
map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM);
|
||||
map.put("MAC", this.MAC == null ? "" : this.MAC);
|
||||
map.put("MTU", this.MTU == null ? 0 : this.MTU);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
map.put("currently_attached", this.currentlyAttached == null ? false : this.currentlyAttached);
|
||||
map.put("status_code", this.statusCode == null ? 0 : this.statusCode);
|
||||
map.put("status_detail", this.statusDetail == null ? "" : this.statusDetail);
|
||||
map.put("runtime_properties", this.runtimeProperties == null ? new HashMap<String, String>() : this.runtimeProperties);
|
||||
map.put("qos_algorithm_type", this.qosAlgorithmType == null ? "" : this.qosAlgorithmType);
|
||||
map.put("qos_algorithm_params", this.qosAlgorithmParams == null ? new HashMap<String, String>() : this.qosAlgorithmParams);
|
||||
map.put("qos_supported_algorithms", this.qosSupportedAlgorithms == null ? new LinkedHashSet<String>() : this.qosSupportedAlgorithms);
|
||||
map.put("metrics", this.metrics == null ? new VIFMetrics("OpaqueRef:NULL") : this.metrics);
|
||||
map.put("MAC_autogenerated", this.MACAutogenerated == null ? false : this.MACAutogenerated);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* list of the operations allowed in this state. This list is advisory only and the server state may have changed by the time this field is read by a client.
|
||||
*/
|
||||
public Set<Types.VifOperations> allowedOperations;
|
||||
/**
|
||||
* links each of the running tasks using this object (by reference) to a current_operation enum which describes the nature of the task.
|
||||
*/
|
||||
public Map<String, Types.VifOperations> currentOperations;
|
||||
/**
|
||||
* order in which VIF backends are created by xapi
|
||||
*/
|
||||
public String device;
|
||||
/**
|
||||
* virtual network to which this vif is connected
|
||||
*/
|
||||
public Network network;
|
||||
/**
|
||||
* virtual machine to which this vif is connected
|
||||
*/
|
||||
public VM VM;
|
||||
/**
|
||||
* ethernet MAC address of virtual interface, as exposed to guest
|
||||
*/
|
||||
public String MAC;
|
||||
/**
|
||||
* MTU in octets
|
||||
*/
|
||||
public Long MTU;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
/**
|
||||
* is the device currently attached (erased on reboot)
|
||||
*/
|
||||
public Boolean currentlyAttached;
|
||||
/**
|
||||
* error/success code associated with last attach-operation (erased on reboot)
|
||||
*/
|
||||
public Long statusCode;
|
||||
/**
|
||||
* error/success information associated with last attach-operation status (erased on reboot)
|
||||
*/
|
||||
public String statusDetail;
|
||||
/**
|
||||
* Device runtime properties
|
||||
*/
|
||||
public Map<String, String> runtimeProperties;
|
||||
/**
|
||||
* QoS algorithm to use
|
||||
*/
|
||||
public String qosAlgorithmType;
|
||||
/**
|
||||
* parameters for chosen QoS algorithm
|
||||
*/
|
||||
public Map<String, String> qosAlgorithmParams;
|
||||
/**
|
||||
* supported QoS algorithms for this VIF
|
||||
*/
|
||||
public Set<String> qosSupportedAlgorithms;
|
||||
/**
|
||||
* metrics associated with this VIF
|
||||
*/
|
||||
public VIFMetrics metrics;
|
||||
/**
|
||||
* true if the MAC was autogenerated; false indicates it was set manually
|
||||
*/
|
||||
public Boolean MACAutogenerated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given VIF.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public VIF.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVIFRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the VIF instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static VIF getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new VIF instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, VIF.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VIF.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new VIF instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
public static VIF create(Connection c, VIF.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified VIF instance.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VIF.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified VIF instance.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the allowed_operations field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<Types.VifOperations> getAllowedOperations(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_allowed_operations";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVifOperations(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current_operations field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, Types.VifOperations> getCurrentOperations(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_current_operations";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringVifOperations(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getDevice(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_device";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the network field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Network getNetwork(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_network";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toNetwork(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VM field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public VM getVM(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_VM";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MAC field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getMAC(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_MAC";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MTU field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getMTU(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_MTU";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently_attached field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getCurrentlyAttached(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_currently_attached";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status_code field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getStatusCode(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_status_code";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status_detail field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getStatusDetail(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_status_detail";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the runtime_properties field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getRuntimeProperties(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_runtime_properties";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the qos/algorithm_type field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getQosAlgorithmType(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_qos_algorithm_type";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the qos/algorithm_params field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getQosAlgorithmParams(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_qos_algorithm_params";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the qos/supported_algorithms field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<String> getQosSupportedAlgorithms(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_qos_supported_algorithms";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the metrics field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public VIFMetrics getMetrics(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_metrics";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVIFMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MAC_autogenerated field of the given VIF.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getMACAutogenerated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_MAC_autogenerated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given VIF.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given VIF.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given VIF. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the qos/algorithm_type field of the given VIF.
|
||||
*
|
||||
* @param algorithmType New value to set
|
||||
*/
|
||||
public void setQosAlgorithmType(Connection c, String algorithmType) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.set_qos_algorithm_type";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(algorithmType)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the qos/algorithm_params field of the given VIF.
|
||||
*
|
||||
* @param algorithmParams New value to set
|
||||
*/
|
||||
public void setQosAlgorithmParams(Connection c, Map<String, String> algorithmParams) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.set_qos_algorithm_params";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(algorithmParams)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the qos/algorithm_params field of the given VIF.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToQosAlgorithmParams(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.add_to_qos_algorithm_params";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the qos/algorithm_params field of the given VIF. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromQosAlgorithmParams(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.remove_from_qos_algorithm_params";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hotplug the specified VIF, dynamically attaching it to the running VM
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task plugAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VIF.plug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hotplug the specified VIF, dynamically attaching it to the running VM
|
||||
*
|
||||
*/
|
||||
public void plug(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.plug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hot-unplug the specified VIF, dynamically unattaching it from the running VM
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task unplugAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VIF.unplug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hot-unplug the specified VIF, dynamically unattaching it from the running VM
|
||||
*
|
||||
*/
|
||||
public void unplug(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.unplug";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the VIFs known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<VIF> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of VIF references to VIF records for all VIFs known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<VIF, VIF.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfVIFVIFRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,327 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* The metrics associated with a virtual network device
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class VIFMetrics extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
VIFMetrics(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a VIFMetrics, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof VIFMetrics)
|
||||
{
|
||||
VIFMetrics other = (VIFMetrics) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a VIFMetrics
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "ioReadKbs", this.ioReadKbs);
|
||||
print.printf("%1$20s: %2$s\n", "ioWriteKbs", this.ioWriteKbs);
|
||||
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a VIF_metrics.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("io_read_kbs", this.ioReadKbs == null ? 0.0 : this.ioReadKbs);
|
||||
map.put("io_write_kbs", this.ioWriteKbs == null ? 0.0 : this.ioWriteKbs);
|
||||
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* Read bandwidth (KiB/s)
|
||||
*/
|
||||
public Double ioReadKbs;
|
||||
/**
|
||||
* Write bandwidth (KiB/s)
|
||||
*/
|
||||
public Double ioWriteKbs;
|
||||
/**
|
||||
* Time at which this information was last updated
|
||||
*/
|
||||
public Date lastUpdated;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given VIF_metrics.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public VIFMetrics.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVIFMetricsRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the VIF_metrics instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static VIFMetrics getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVIFMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given VIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the io/read_kbs field of the given VIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getIoReadKbs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_io_read_kbs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the io/write_kbs field of the given VIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Double getIoWriteKbs(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_io_write_kbs";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_updated field of the given VIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastUpdated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_last_updated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given VIF_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given VIF_metrics.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given VIF_metrics.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given VIF_metrics. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the VIF_metrics instances known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<VIFMetrics> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVIFMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of VIF_metrics references to VIF_metrics records for all VIF_metrics instances known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<VIFMetrics, VIFMetrics.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VIF_metrics.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfVIFMetricsVIFMetricsRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,399 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A VLAN mux/demux
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class VLAN extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
VLAN(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a VLAN, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof VLAN)
|
||||
{
|
||||
VLAN other = (VLAN) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a VLAN
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "taggedPIF", this.taggedPIF);
|
||||
print.printf("%1$20s: %2$s\n", "untaggedPIF", this.untaggedPIF);
|
||||
print.printf("%1$20s: %2$s\n", "tag", this.tag);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a VLAN.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("tagged_PIF", this.taggedPIF == null ? new PIF("OpaqueRef:NULL") : this.taggedPIF);
|
||||
map.put("untagged_PIF", this.untaggedPIF == null ? new PIF("OpaqueRef:NULL") : this.untaggedPIF);
|
||||
map.put("tag", this.tag == null ? 0 : this.tag);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* interface on which traffic is tagged
|
||||
*/
|
||||
public PIF taggedPIF;
|
||||
/**
|
||||
* interface on which traffic is untagged
|
||||
*/
|
||||
public PIF untaggedPIF;
|
||||
/**
|
||||
* VLAN tag in use
|
||||
*/
|
||||
public Long tag;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given VLAN.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public VLAN.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVLANRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the VLAN instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static VLAN getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVLAN(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given VLAN.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tagged_PIF field of the given VLAN.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public PIF getTaggedPIF(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_tagged_PIF";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the untagged_PIF field of the given VLAN.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public PIF getUntaggedPIF(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_untagged_PIF";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toPIF(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tag field of the given VLAN.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getTag(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_tag";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given VLAN.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given VLAN.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given VLAN.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given VLAN. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a VLAN mux/demuxer
|
||||
*
|
||||
* @param taggedPIF PIF which receives the tagged traffic
|
||||
* @param tag VLAN tag to use
|
||||
* @param network Network to receive the untagged traffic
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, PIF taggedPIF, Long tag, Network network) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VLAN.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(taggedPIF), Marshalling.toXMLRPC(tag), Marshalling.toXMLRPC(network)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a VLAN mux/demuxer
|
||||
*
|
||||
* @param taggedPIF PIF which receives the tagged traffic
|
||||
* @param tag VLAN tag to use
|
||||
* @param network Network to receive the untagged traffic
|
||||
* @return The reference of the created VLAN object
|
||||
*/
|
||||
public static VLAN create(Connection c, PIF taggedPIF, Long tag, Network network) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.create";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(taggedPIF), Marshalling.toXMLRPC(tag), Marshalling.toXMLRPC(network)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVLAN(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a VLAN mux/demuxer
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VLAN.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a VLAN mux/demuxer
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the VLANs known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<VLAN> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVLAN(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of VLAN references to VLAN records for all VLANs known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<VLAN, VLAN.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VLAN.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfVLANVLANRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
4253
deps/XenServerJava/src/com/xensource/xenapi/VM.java
vendored
4253
deps/XenServerJava/src/com/xensource/xenapi/VM.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,465 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* The metrics reported by the guest (as opposed to inferred from outside)
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class VMGuestMetrics extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
VMGuestMetrics(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a VMGuestMetrics, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof VMGuestMetrics)
|
||||
{
|
||||
VMGuestMetrics other = (VMGuestMetrics) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a VMGuestMetrics
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "osVersion", this.osVersion);
|
||||
print.printf("%1$20s: %2$s\n", "PVDriversVersion", this.PVDriversVersion);
|
||||
print.printf("%1$20s: %2$s\n", "PVDriversUpToDate", this.PVDriversUpToDate);
|
||||
print.printf("%1$20s: %2$s\n", "memory", this.memory);
|
||||
print.printf("%1$20s: %2$s\n", "disks", this.disks);
|
||||
print.printf("%1$20s: %2$s\n", "networks", this.networks);
|
||||
print.printf("%1$20s: %2$s\n", "other", this.other);
|
||||
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
print.printf("%1$20s: %2$s\n", "live", this.live);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a VM_guest_metrics.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("os_version", this.osVersion == null ? new HashMap<String, String>() : this.osVersion);
|
||||
map.put("PV_drivers_version", this.PVDriversVersion == null ? new HashMap<String, String>() : this.PVDriversVersion);
|
||||
map.put("PV_drivers_up_to_date", this.PVDriversUpToDate == null ? false : this.PVDriversUpToDate);
|
||||
map.put("memory", this.memory == null ? new HashMap<String, String>() : this.memory);
|
||||
map.put("disks", this.disks == null ? new HashMap<String, String>() : this.disks);
|
||||
map.put("networks", this.networks == null ? new HashMap<String, String>() : this.networks);
|
||||
map.put("other", this.other == null ? new HashMap<String, String>() : this.other);
|
||||
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
map.put("live", this.live == null ? false : this.live);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* version of the OS
|
||||
*/
|
||||
public Map<String, String> osVersion;
|
||||
/**
|
||||
* version of the PV drivers
|
||||
*/
|
||||
public Map<String, String> PVDriversVersion;
|
||||
/**
|
||||
* true if the PV drivers appear to be up to date
|
||||
*/
|
||||
public Boolean PVDriversUpToDate;
|
||||
/**
|
||||
* free/used/total memory
|
||||
*/
|
||||
public Map<String, String> memory;
|
||||
/**
|
||||
* disk configuration/free space
|
||||
*/
|
||||
public Map<String, String> disks;
|
||||
/**
|
||||
* network configuration
|
||||
*/
|
||||
public Map<String, String> networks;
|
||||
/**
|
||||
* anything else
|
||||
*/
|
||||
public Map<String, String> other;
|
||||
/**
|
||||
* Time at which this information was last updated
|
||||
*/
|
||||
public Date lastUpdated;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
/**
|
||||
* True if the guest is sending heartbeat messages via the guest agent
|
||||
*/
|
||||
public Boolean live;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given VM_guest_metrics.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public VMGuestMetrics.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVMGuestMetricsRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the VM_guest_metrics instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static VMGuestMetrics getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVMGuestMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the os_version field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOsVersion(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_os_version";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PV_drivers_version field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getPVDriversVersion(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_PV_drivers_version";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PV_drivers_up_to_date field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getPVDriversUpToDate(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_PV_drivers_up_to_date";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the memory field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getMemory(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_memory";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the disks field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getDisks(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_disks";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the networks field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getNetworks(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_networks";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOther(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_other";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_updated field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastUpdated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_last_updated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the live field of the given VM_guest_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Boolean getLive(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_live";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toBoolean(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given VM_guest_metrics.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given VM_guest_metrics.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given VM_guest_metrics. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the VM_guest_metrics instances known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<VMGuestMetrics> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVMGuestMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of VM_guest_metrics references to VM_guest_metrics records for all VM_guest_metrics instances known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<VMGuestMetrics, VMGuestMetrics.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_guest_metrics.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfVMGuestMetricsVMGuestMetricsRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,488 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* The metrics associated with a VM
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class VMMetrics extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
VMMetrics(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a VMMetrics, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof VMMetrics)
|
||||
{
|
||||
VMMetrics other = (VMMetrics) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a VMMetrics
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "memoryActual", this.memoryActual);
|
||||
print.printf("%1$20s: %2$s\n", "VCPUsNumber", this.VCPUsNumber);
|
||||
print.printf("%1$20s: %2$s\n", "VCPUsUtilisation", this.VCPUsUtilisation);
|
||||
print.printf("%1$20s: %2$s\n", "VCPUsCPU", this.VCPUsCPU);
|
||||
print.printf("%1$20s: %2$s\n", "VCPUsParams", this.VCPUsParams);
|
||||
print.printf("%1$20s: %2$s\n", "VCPUsFlags", this.VCPUsFlags);
|
||||
print.printf("%1$20s: %2$s\n", "state", this.state);
|
||||
print.printf("%1$20s: %2$s\n", "startTime", this.startTime);
|
||||
print.printf("%1$20s: %2$s\n", "installTime", this.installTime);
|
||||
print.printf("%1$20s: %2$s\n", "lastUpdated", this.lastUpdated);
|
||||
print.printf("%1$20s: %2$s\n", "otherConfig", this.otherConfig);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a VM_metrics.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("memory_actual", this.memoryActual == null ? 0 : this.memoryActual);
|
||||
map.put("VCPUs_number", this.VCPUsNumber == null ? 0 : this.VCPUsNumber);
|
||||
map.put("VCPUs_utilisation", this.VCPUsUtilisation == null ? new HashMap<Long, Double>() : this.VCPUsUtilisation);
|
||||
map.put("VCPUs_CPU", this.VCPUsCPU == null ? new HashMap<Long, Long>() : this.VCPUsCPU);
|
||||
map.put("VCPUs_params", this.VCPUsParams == null ? new HashMap<String, String>() : this.VCPUsParams);
|
||||
map.put("VCPUs_flags", this.VCPUsFlags == null ? new HashMap<Long, Set<String>>() : this.VCPUsFlags);
|
||||
map.put("state", this.state == null ? new LinkedHashSet<String>() : this.state);
|
||||
map.put("start_time", this.startTime == null ? new Date(0) : this.startTime);
|
||||
map.put("install_time", this.installTime == null ? new Date(0) : this.installTime);
|
||||
map.put("last_updated", this.lastUpdated == null ? new Date(0) : this.lastUpdated);
|
||||
map.put("other_config", this.otherConfig == null ? new HashMap<String, String>() : this.otherConfig);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* Guest's actual memory (bytes)
|
||||
*/
|
||||
public Long memoryActual;
|
||||
/**
|
||||
* Current number of VCPUs
|
||||
*/
|
||||
public Long VCPUsNumber;
|
||||
/**
|
||||
* Utilisation for all of guest's current VCPUs
|
||||
*/
|
||||
public Map<Long, Double> VCPUsUtilisation;
|
||||
/**
|
||||
* VCPU to PCPU map
|
||||
*/
|
||||
public Map<Long, Long> VCPUsCPU;
|
||||
/**
|
||||
* The live equivalent to VM.VCPUs_params
|
||||
*/
|
||||
public Map<String, String> VCPUsParams;
|
||||
/**
|
||||
* CPU flags (blocked,online,running)
|
||||
*/
|
||||
public Map<Long, Set<String>> VCPUsFlags;
|
||||
/**
|
||||
* The state of the guest, eg blocked, dying etc
|
||||
*/
|
||||
public Set<String> state;
|
||||
/**
|
||||
* Time at which this VM was last booted
|
||||
*/
|
||||
public Date startTime;
|
||||
/**
|
||||
* Time at which the VM was installed
|
||||
*/
|
||||
public Date installTime;
|
||||
/**
|
||||
* Time at which this information was last updated
|
||||
*/
|
||||
public Date lastUpdated;
|
||||
/**
|
||||
* additional configuration
|
||||
*/
|
||||
public Map<String, String> otherConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given VM_metrics.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public VMMetrics.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVMMetricsRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the VM_metrics instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static VMMetrics getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVMMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the memory/actual field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getMemoryActual(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_memory_actual";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VCPUs/number field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Long getVCPUsNumber(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_VCPUs_number";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VCPUs/utilisation field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<Long, Double> getVCPUsUtilisation(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_VCPUs_utilisation";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfLongDouble(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VCPUs/CPU field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<Long, Long> getVCPUsCPU(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_VCPUs_CPU";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfLongLong(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VCPUs/params field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getVCPUsParams(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_VCPUs_params";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VCPUs/flags field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<Long, Set<String>> getVCPUsFlags(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_VCPUs_flags";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfLongSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Set<String> getState(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_state";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start_time field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getStartTime(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_start_time";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the install_time field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getInstallTime(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_install_time";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last_updated field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Date getLastUpdated(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_last_updated";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toDate(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other_config field of the given VM_metrics.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public Map<String, String> getOtherConfig(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfStringString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the other_config field of the given VM_metrics.
|
||||
*
|
||||
* @param otherConfig New value to set
|
||||
*/
|
||||
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.set_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(otherConfig)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given key-value pair to the other_config field of the given VM_metrics.
|
||||
*
|
||||
* @param key Key to add
|
||||
* @param value Value to add
|
||||
*/
|
||||
public void addToOtherConfig(Connection c, String key, String value) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.add_to_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key), Marshalling.toXMLRPC(value)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given key and its corresponding value from the other_config field of the given VM_metrics. If the key is not in that Map, then do nothing.
|
||||
*
|
||||
* @param key Key to remove
|
||||
*/
|
||||
public void removeFromOtherConfig(Connection c, String key) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.remove_from_other_config";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref), Marshalling.toXMLRPC(key)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all the VM_metrics instances known to the system.
|
||||
*
|
||||
* @return references to all objects
|
||||
*/
|
||||
public static Set<VMMetrics> getAll(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_all";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toSetOfVMMetrics(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of VM_metrics references to VM_metrics records for all VM_metrics instances known to the system.
|
||||
*
|
||||
* @return records of all objects
|
||||
*/
|
||||
public static Map<VMMetrics, VMMetrics.Record> getAllRecords(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VM_metrics.get_all_records";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toMapOfVMMetricsVMMetricsRecord(result);
|
||||
}
|
||||
|
||||
}
|
||||
1136
deps/XenServerJava/src/com/xensource/xenapi/VMPP.java
vendored
1136
deps/XenServerJava/src/com/xensource/xenapi/VMPP.java
vendored
File diff suppressed because it is too large
Load Diff
@ -1,268 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
import com.xensource.xenapi.Types.BadServerResponse;
|
||||
import com.xensource.xenapi.Types.VersionException;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
/**
|
||||
* A virtual TPM device
|
||||
*
|
||||
* @author Citrix Systems, Inc.
|
||||
*/
|
||||
public class VTPM extends XenAPIObject {
|
||||
|
||||
/**
|
||||
* The XenAPI reference to this object.
|
||||
*/
|
||||
protected final String ref;
|
||||
|
||||
/**
|
||||
* For internal use only.
|
||||
*/
|
||||
VTPM(String ref) {
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
public String toWireString() {
|
||||
return this.ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* If obj is a VTPM, compares XenAPI references for equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null && obj instanceof VTPM)
|
||||
{
|
||||
VTPM other = (VTPM) obj;
|
||||
return other.ref.equals(this.ref);
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ref.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents all the fields in a VTPM
|
||||
*/
|
||||
public static class Record implements Types.Record {
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
PrintWriter print = new PrintWriter(writer);
|
||||
print.printf("%1$20s: %2$s\n", "uuid", this.uuid);
|
||||
print.printf("%1$20s: %2$s\n", "VM", this.VM);
|
||||
print.printf("%1$20s: %2$s\n", "backend", this.backend);
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a VTPM.Record to a Map
|
||||
*/
|
||||
public Map<String,Object> toMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("uuid", this.uuid == null ? "" : this.uuid);
|
||||
map.put("VM", this.VM == null ? new VM("OpaqueRef:NULL") : this.VM);
|
||||
map.put("backend", this.backend == null ? new VM("OpaqueRef:NULL") : this.backend);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier/object reference
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* the virtual machine
|
||||
*/
|
||||
public VM VM;
|
||||
/**
|
||||
* the domain where the backend is located
|
||||
*/
|
||||
public VM backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a record containing the current state of the given VTPM.
|
||||
*
|
||||
* @return all fields from the object
|
||||
*/
|
||||
public VTPM.Record getRecord(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VTPM.get_record";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVTPMRecord(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the VTPM instance with the specified UUID.
|
||||
*
|
||||
* @param uuid UUID of object to return
|
||||
* @return reference to the object
|
||||
*/
|
||||
public static VTPM getByUuid(Connection c, String uuid) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VTPM.get_by_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(uuid)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVTPM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new VTPM instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return Task
|
||||
*/
|
||||
public static Task createAsync(Connection c, VTPM.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VTPM.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new VTPM instance, and return its handle.
|
||||
*
|
||||
* @param record All constructor arguments
|
||||
* @return reference to the newly created object
|
||||
*/
|
||||
public static VTPM create(Connection c, VTPM.Record record) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VTPM.create";
|
||||
String session = c.getSessionReference();
|
||||
Map<String, Object> record_map = record.toMap();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(record_map)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVTPM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified VTPM instance.
|
||||
*
|
||||
* @return Task
|
||||
*/
|
||||
public Task destroyAsync(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "Async.VTPM.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toTask(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the specified VTPM instance.
|
||||
*
|
||||
*/
|
||||
public void destroy(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VTPM.destroy";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uuid field of the given VTPM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public String getUuid(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VTPM.get_uuid";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VM field of the given VTPM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public VM getVM(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VTPM.get_VM";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVM(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the backend field of the given VTPM.
|
||||
*
|
||||
* @return value of the field
|
||||
*/
|
||||
public VM getBackend(Connection c) throws
|
||||
BadServerResponse,
|
||||
XenAPIException,
|
||||
XmlRpcException {
|
||||
String method_call = "VTPM.get_backend";
|
||||
String session = c.getSessionReference();
|
||||
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
|
||||
Map response = c.dispatch(method_call, method_params);
|
||||
Object result = response.get("Value");
|
||||
return Types.toVM(result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.xensource.xenapi;
|
||||
|
||||
public abstract class XenAPIObject
|
||||
{
|
||||
public abstract String toWireString();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user