Class StandardOpenstackClient
- java.lang.Object
-
- com.elastisys.scale.cloudpool.openstack.driver.client.StandardOpenstackClient
-
- All Implemented Interfaces:
OpenstackClient
public class StandardOpenstackClient extends java.lang.Object implements OpenstackClient
Standard implementation of theOpenstackClientinterface.
-
-
Constructor Summary
Constructors Constructor Description StandardOpenstackClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringassignFloatingIp(java.lang.String serverId)Allocate a floating IP address and associate it with a given server.com.elastisys.scale.commons.openstack.OSClientFactoryclientFactory()voidconfigure(CloudApiSettings configuration)Configures thisOpenstackClientwith cloud API access credentials and settings.org.openstack4j.model.compute.ServergetServer(java.lang.String serverId)Return meta data about a particularServerinstance.java.util.List<org.openstack4j.model.compute.Server>getServers(java.lang.String tag, java.lang.String tagValue)Retrieves all servers that match a given tag.org.openstack4j.model.compute.ServerlaunchServer(java.lang.String serverName, ProvisioningTemplate provisioningDetails, java.util.Map<java.lang.String,java.lang.String> tags)Launch a new server.voidtagServer(java.lang.String serverId, java.util.Map<java.lang.String,java.lang.String> tags)Adds meta data tags to a given server.voidterminateServer(java.lang.String serverId)Terminates a particular server.voiduntagServer(java.lang.String serverId, java.util.List<java.lang.String> tagKeys)Removes a collection of meta data tags from a given server.
-
-
-
Method Detail
-
configure
public void configure(CloudApiSettings configuration)
Description copied from interface:OpenstackClientConfigures thisOpenstackClientwith cloud API access credentials and settings.- Specified by:
configurein interfaceOpenstackClient- Parameters:
configuration- API access credentials and settings.
-
getServers
public java.util.List<org.openstack4j.model.compute.Server> getServers(java.lang.String tag, java.lang.String tagValue) throws org.openstack4j.api.exceptions.ResponseExceptionDescription copied from interface:OpenstackClientRetrieves all servers that match a given tag.- Specified by:
getServersin interfaceOpenstackClient- Parameters:
tag- A meta data tag that must be present on returned servers.tagValue- The value for the meta data tag that must be present on returned servers.- Returns:
- All
Servers matching the filters. - Throws:
org.openstack4j.api.exceptions.ResponseException- On communication errors.
-
getServer
public org.openstack4j.model.compute.Server getServer(java.lang.String serverId) throws NotFoundException, org.openstack4j.api.exceptions.ResponseExceptionDescription copied from interface:OpenstackClientReturn meta data about a particularServerinstance.- Specified by:
getServerin interfaceOpenstackClient- Parameters:
serverId- The identifier of the requested server.- Returns:
Servermeta data.- Throws:
NotFoundException- if the server doesn't exist.org.openstack4j.api.exceptions.ResponseException- On communication errors.
-
launchServer
public org.openstack4j.model.compute.Server launchServer(java.lang.String serverName, ProvisioningTemplate provisioningDetails, java.util.Map<java.lang.String,java.lang.String> tags) throws org.openstack4j.api.exceptions.ResponseExceptionDescription copied from interface:OpenstackClientLaunch a new server.- Specified by:
launchServerin interfaceOpenstackClient- Parameters:
serverName- The name to assign to the created server.provisioningDetails- The provisioning details on how to launch the new server.tags- Meta data tags to set on the launched server.- Returns:
- The launched
Server. - Throws:
org.openstack4j.api.exceptions.ResponseException- On communication errors.
-
assignFloatingIp
public java.lang.String assignFloatingIp(java.lang.String serverId) throws NotFoundException, org.openstack4j.api.exceptions.ResponseExceptionDescription copied from interface:OpenstackClientAllocate a floating IP address and associate it with a given server.- Specified by:
assignFloatingIpin interfaceOpenstackClient- Parameters:
serverId- The identifier of the server that will be assigned a floating IP address.- Returns:
- The IP address that was assigned to the server.
- Throws:
org.openstack4j.api.exceptions.ResponseException- On communication errors.NotFoundException
-
terminateServer
public void terminateServer(java.lang.String serverId) throws NotFoundException, org.openstack4j.api.exceptions.ResponseExceptionDescription copied from interface:OpenstackClientTerminates a particular server.- Specified by:
terminateServerin interfaceOpenstackClient- Parameters:
serverId- Identifier of the server to be terminated.- Throws:
NotFoundException- if the server doesn't exist.org.openstack4j.api.exceptions.ResponseException- On communication errors.
-
tagServer
public void tagServer(java.lang.String serverId, java.util.Map<java.lang.String,java.lang.String> tags) throws org.openstack4j.api.exceptions.ResponseExceptionDescription copied from interface:OpenstackClientAdds meta data tags to a given server.- Specified by:
tagServerin interfaceOpenstackClient- Parameters:
serverId- Identifier of the server to be tagged.tags- Meta data tags to set on the server.- Throws:
org.openstack4j.api.exceptions.ResponseException- On communication errors.
-
untagServer
public void untagServer(java.lang.String serverId, java.util.List<java.lang.String> tagKeys) throws org.openstack4j.api.exceptions.ResponseExceptionDescription copied from interface:OpenstackClientRemoves a collection of meta data tags from a given server.- Specified by:
untagServerin interfaceOpenstackClient- Parameters:
serverId- Identifier of the server to be untagged.- Throws:
org.openstack4j.api.exceptions.ResponseException- On communication errors.
-
clientFactory
public com.elastisys.scale.commons.openstack.OSClientFactory clientFactory()
-
-