Package org.opennebula.client.template
Class Template
java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.template.Template
This class represents an OpenNebula template.
It also offers static XML-RPC call wrappers.
-
Field Summary
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OneResponse
Allocates a new Template in OpenNebula.chgrp
(int gid) Changes the groupchmod
(int octet) Changes the permissionschmod
(int octet, boolean recursive) Changes the permissionschmod
(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the template permissionschmod
(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a, boolean recursive) Changes the template permissionsChanges the permissionsChanges the permissionsstatic OneResponse
Changes the permissionsstatic OneResponse
Changes the permissionsstatic OneResponse
chmod
(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the template permissionsstatic OneResponse
chmod
(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a, boolean recursive) Changes the template permissionsstatic OneResponse
Changes the permissionsstatic OneResponse
Changes the permissionschown
(int uid) Changes the ownerchown
(int uid, int gid) Changes the owner/groupstatic OneResponse
Changes the owner/groupClones this template into a new oneClones this template into a new onestatic OneResponse
Clones this template into a new onestatic OneResponse
Clones this template into a new onedelete()
Deletes the template from OpenNebula.delete
(boolean recursive) Deletes the template from OpenNebula.static OneResponse
Deletes a template from OpenNebula.info()
Retrieves the information of the Template.info
(boolean extended) Retrieves the information of the given Template.static OneResponse
Retrieves the information of the given Template.static OneResponse
Retrieves the information of the given Template.static OneResponse
Retrieves the information of the given Template.Creates a VM instance from a Templateinstantiate
(String name) Creates a VM instance from a Templateinstantiate
(String name, boolean onHold, String template, boolean persistent) Creates a VM instance from a Templatestatic OneResponse
instantiate
(Client client, int id, String name, boolean onHold, String template, boolean persistent) Creates a VM instance from a Templatelock
(int level) Lock this templatestatic OneResponse
lock this templatepublish()
Publishes the template.publish
(boolean publish) Publishes or unpublishes the template.static OneResponse
Publishes or unpublishes a template.Renames this Templatestatic OneResponse
Renames this Templateunlock()
Unlock this templatestatic OneResponse
Unlock this templateUnpublishes the template.Replaces the template contents.Replaces the template contents.static OneResponse
Replaces the template contents.
-
Constructor Details
-
Template
Creates a new Template representation.- Parameters:
id
- The template id.client
- XML-RPC Client.
-
Template
- See Also:
-
-
Method Details
-
allocate
Allocates a new Template in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the template.- Returns:
- If successful the message contains the associated id generated for this Template.
-
info
Retrieves the information of the given Template.- Parameters:
client
- XML-RPC Client.id
- The template id for the template to retrieve the information from- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
Retrieves the information of the given Template.- Parameters:
client
- XML-RPC Client.id
- The template id for the template to retrieve the information fromextended
- optional flag to process the template and include extended information, such as the SIZE for each DISK- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
Retrieves the information of the given Template.- Parameters:
client
- XML-RPC Client.id
- The template id for the template to retrieve the information fromdecrypt
- If true decrypt sensitive attributes- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
Deletes a template from OpenNebula.- Parameters:
client
- XML-RPC Client.id
- The template id of the target template we want to delete.recursive
- deletes the template plus any image defined in DISK.- Returns:
- A encapsulated response.
-
update
Replaces the template contents.- Parameters:
client
- XML-RPC Client.id
- The template id of the target template we want to modify.new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the template id.
-
publish
Publishes or unpublishes a template.- Parameters:
client
- XML-RPC Client.id
- The template id of the target template we want to modify.publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the template id.
-
chown
Changes the owner/group- Parameters:
client
- XML-RPC Client.id
- The template id of the target template we want to modify.uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public static OneResponse chmod(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the template permissions- Parameters:
client
- XML-RPC Client.id
- The template id of the target template.owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public static OneResponse chmod(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a, boolean recursive) Changes the template permissions- Parameters:
client
- XML-RPC Client.id
- The template id of the target template.owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not changerecursive
- chmods the template plus any image defined in DISK.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640recursive
- chmods the template plus any image defined in DISK.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640recursive
- chmods the template plus any image defined in DISK.- Returns:
- If an error occurs the error message contains the reason.
-
instantiate
public static OneResponse instantiate(Client client, int id, String name, boolean onHold, String template, boolean persistent) Creates a VM instance from a Template- Parameters:
client
- XML-RPC Client.id
- The template id of the target template.name
- A string containing the name of the VM instance, can be empty.onHold
- False to create this VM in pending state, true on holdtemplate
- User provided Template to merge with the one being instantiatedpersistent
- true to create a private persistent copy of the template plus any image defined in DISK, and instantiate that copy- Returns:
- If successful the message contains the VM Instance ID.
-
clone
Clones this template into a new one- Parameters:
client
- XML-RPC Client.id
- The template id of the target template.name
- Name for the new template.- Returns:
- If successful the message contains the new template ID.
-
clone
Clones this template into a new one- Parameters:
client
- XML-RPC Client.id
- The template id of the target template.name
- Name for the new template.recursive
- clones the template plus any image defined in DISK. The new IMAGE_ID is set into each DISK.- Returns:
- If successful the message contains the new template ID.
-
rename
Renames this Template- Parameters:
client
- XML-RPC Client.id
- The Template id of the target Template.name
- New name for the Template.- Returns:
- If an error occurs the error message contains the reason.
-
lock
lock this template- Parameters:
client
- XML-RPC Client.id
- The template id.level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
Unlock this template- Parameters:
client
- XML-RPC Client.id
- The template id.- Returns:
- If an error occurs the error message contains the reason.
-
info
Retrieves the information of the Template.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
Retrieves the information of the given Template.- Parameters:
extended
- optional flag to process the template and include extended information, such as the SIZE for each DISK- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
Deletes the template from OpenNebula.- Returns:
- A encapsulated response.
-
delete
Deletes the template from OpenNebula.- Parameters:
recursive
- deletes the template plus any image defined in DISK.- Returns:
- A encapsulated response.
-
update
Replaces the template contents.- Parameters:
new_template
- New template contents.- Returns:
- If successful the message contains the template id.
-
update
Replaces the template contents.- Parameters:
new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the template id.
-
publish
Publishes or unpublishes the template.- Parameters:
publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the template id.
-
publish
Publishes the template.- Returns:
- If successful the message contains the template id.
-
unpublish
Unpublishes the template.- Returns:
- If successful the message contains the template id.
-
chown
Changes the owner/group- Parameters:
uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chown
Changes the owner- Parameters:
uid
- The new owner user ID.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
Changes the group- Parameters:
gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the template permissions- Parameters:
owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a, boolean recursive) Changes the template permissions- Parameters:
owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not changerecursive
- chmods the template plus any image defined in DISK.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640recursive
- chmods the template plus any image defined in DISK.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640recursive
- chmods the template plus any image defined in DISK.- Returns:
- If an error occurs the error message contains the reason.
-
instantiate
Creates a VM instance from a Template- Parameters:
name
- A string containing the name of the VM instance, can be empty.onHold
- False to create this VM in pending state, true on holdtemplate
- User provided Template to merge with the one being instantiatedpersistent
- true to create a private persistent copy of the template plus any image defined in DISK, and instantiate that copy- Returns:
- If successful the message contains the VM Instance ID.
-
instantiate
Creates a VM instance from a Template- Parameters:
name
- A string containing the name of the VM instance, can be empty.- Returns:
- If successful the message contains the VM Instance ID.
-
instantiate
Creates a VM instance from a Template- Returns:
- If successful the message contains the VM Instance ID.
-
clone
Clones this template into a new one- Parameters:
name
- Name for the new template.- Returns:
- If successful the message contains the new template ID.
-
clone
Clones this template into a new one- Parameters:
name
- Name for the new template.recursive
- clones the template plus any image defined in DISK. The new IMAGE_ID is set into each DISK.- Returns:
- If successful the message contains the new template ID.
-
rename
Renames this Template- Parameters:
name
- New name for the Template.- Returns:
- If an error occurs the error message contains the reason.
-
lock
Lock this template- Parameters:
level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
Unlock this template- Returns:
- If an error occurs the error message contains the reason.
-