@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @ThreadSafe public class Openstack extends Object
OSClient
.
It is needed to make sure the client is truly immutable and provide easy-to-mock abstraction for unittesting.
For server manipulation, this implementation provides metadata fingerprinting
to identify machines started via this plugin from given instance so it will not
manipulate servers it does not "own". In other words, pretends that there are no
other machines running in connected tenant except for those started using this class.Modifier and Type | Class and Description |
---|---|
static class |
Openstack.ActionFailed |
static class |
Openstack.Factory |
static class |
Openstack.FactoryEP |
Modifier and Type | Field and Description |
---|---|
static String |
FINGERPRINT_KEY |
Constructor and Description |
---|
Openstack(org.openstack4j.api.OSClient client) |
Modifier and Type | Method and Description |
---|---|
org.openstack4j.model.compute.Server |
_bootAndWaitActive(org.openstack4j.model.compute.builder.ServerCreateBuilder request,
int timeout) |
org.openstack4j.model.compute.FloatingIP |
assignFloatingIp(org.openstack4j.model.compute.Server server,
String poolName)
Assign floating ip address to the server.
|
org.openstack4j.model.compute.Server |
bootAndWaitActive(org.openstack4j.model.compute.builder.ServerCreateBuilder request,
int timeout)
Provision machine and wait until ready.
|
void |
destroyFip(String fip) |
void |
destroyServer(org.openstack4j.model.compute.Server server)
Delete server eagerly.
|
Date |
getExpires()
Date representing time until this instance is valid to be used.
|
List<String> |
getFreeFipIds() |
String |
getImageIdFor(String name) |
static String |
getPublicAddress(org.openstack4j.model.compute.Server server)
Extract public address from server info.
|
static String |
getPublicAddressIpv4(org.openstack4j.model.compute.Server server)
Extract public address from server info.
|
static org.openstack4j.model.compute.Address |
getPublicAddressObject(org.openstack4j.model.compute.Server server)
Extract public address from server info.
|
List<org.openstack4j.model.compute.Server> |
getRunningNodes() |
org.openstack4j.model.compute.Server |
getServerById(String id) |
List<org.openstack4j.model.compute.Server> |
getServersByName(String name) |
Collection<? extends org.openstack4j.model.compute.Flavor> |
getSortedFlavors() |
Collection<org.openstack4j.model.image.Image> |
getSortedImages() |
List<String> |
getSortedIpPools() |
List<String> |
getSortedKeyPairNames() |
Collection<? extends org.openstack4j.model.network.Network> |
getSortedNetworks() |
Throwable |
sanityCheck()
Perform some tests before calling the connection successfully established.
|
org.openstack4j.model.compute.Server |
updateInfo(org.openstack4j.model.compute.Server server)
Fetch updated info about the server.
|
public static final String FINGERPRINT_KEY
public Openstack(@Nonnull org.openstack4j.api.OSClient client)
@Nonnull public Date getExpires()
@Nonnull public Collection<? extends org.openstack4j.model.network.Network> getSortedNetworks()
@Nonnull public Collection<org.openstack4j.model.image.Image> getSortedImages()
@Nonnull public Collection<? extends org.openstack4j.model.compute.Flavor> getSortedFlavors()
@CheckForNull public String getImageIdFor(String name)
@Nonnull public org.openstack4j.model.compute.Server getServerById(@Nonnull String id) throws NoSuchElementException
NoSuchElementException
@Nonnull public List<org.openstack4j.model.compute.Server> getServersByName(@Nonnull String name)
@Nonnull public org.openstack4j.model.compute.Server bootAndWaitActive(@Nonnull org.openstack4j.model.compute.builder.ServerCreateBuilder request, @Nonnegative int timeout) throws Openstack.ActionFailed
Openstack.ActionFailed
- Openstack failed to provision the slave or it was in erroneous state (server will be deleted in such case).@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public org.openstack4j.model.compute.Server _bootAndWaitActive(@Nonnull org.openstack4j.model.compute.builder.ServerCreateBuilder request, @Nonnegative int timeout)
@Nonnull public org.openstack4j.model.compute.Server updateInfo(@Nonnull org.openstack4j.model.compute.Server server)
public void destroyServer(@Nonnull org.openstack4j.model.compute.Server server) throws Openstack.ActionFailed
DestroyMachine
to destroy the server reliably.Openstack.ActionFailed
@Nonnull public org.openstack4j.model.compute.FloatingIP assignFloatingIp(@Nonnull org.openstack4j.model.compute.Server server, @CheckForNull String poolName) throws Openstack.ActionFailed
server
- Server to assign FIPpoolName
- Name of the FIP pool to use. If null, openstack default pool will be used.Openstack.ActionFailed
public void destroyFip(String fip)
@CheckForNull public static org.openstack4j.model.compute.Address getPublicAddressObject(@Nonnull org.openstack4j.model.compute.Server server)
@CheckForNull public static String getPublicAddress(@Nonnull org.openstack4j.model.compute.Server server)
@CheckForNull public static String getPublicAddressIpv4(@Nonnull org.openstack4j.model.compute.Server server)
@CheckForNull public Throwable sanityCheck()
Copyright © 2016–2017. All rights reserved.