Class CreateServerRequest

  • All Implemented Interfaces:
    java.util.concurrent.Callable<org.openstack4j.model.compute.Server>

    public class CreateServerRequest
    extends AbstractOpenstackRequest<org.openstack4j.model.compute.Server>
    An request that, when executed, creates a new server instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      CreateServerRequest​(com.elastisys.scale.commons.openstack.OSClientFactory clientFactory, java.lang.String serverName, java.lang.String flavorName, java.lang.String imageName, java.lang.String keyPair, java.util.List<java.lang.String> securityGroups, java.util.List<java.lang.String> networks, java.lang.String encodedUserData, java.util.Map<java.lang.String,​java.lang.String> metadata)
      Creates a new CreateServerRequest.
    • Constructor Detail

      • CreateServerRequest

        public CreateServerRequest​(com.elastisys.scale.commons.openstack.OSClientFactory clientFactory,
                                   java.lang.String serverName,
                                   java.lang.String flavorName,
                                   java.lang.String imageName,
                                   java.lang.String keyPair,
                                   java.util.List<java.lang.String> securityGroups,
                                   java.util.List<java.lang.String> networks,
                                   java.lang.String encodedUserData,
                                   java.util.Map<java.lang.String,​java.lang.String> metadata)
                            throws org.openstack4j.api.exceptions.ResponseException
        Creates a new CreateServerRequest.
        Parameters:
        clientFactory - OpenStack API client factory.
        serverName - The name to assign to the new server.
        flavorName - The name of the machine type (flavor) to launch.
        imageName - The identifier of the machine image used to boot the machine.
        keyPair - The name of the key pair to use for the machine instance. May be null.
        securityGroups - The security group(s) to use for the new machine instance. May be null.
        networks - The names of the networks to attach the launched server to (for example, private). Each network creates a separate network interface controller (NIC) on the created server. Typically, this option can be left out, but in rare cases, when an account has more than one network to choose from, the OpenStack API forces us to be explicit about the network(s) we want to use.

        If set to null or left empty, the default behavior is to use which ever network is configured by the cloud provider for the user/project. However, if there are multiple choices, this will cause server boot requests to fail.

        encodedUserData - The base64-encoded user data used to contextualize the started instance. May be null.
        metadata - Any meta data tags to assign to the new server. May be null.
        Throws:
        org.openstack4j.api.exceptions.ResponseException
    • Method Detail

      • doRequest

        public org.openstack4j.model.compute.Server doRequest​(org.openstack4j.api.OSClient api)
                                                       throws NotFoundException,
                                                              org.openstack4j.api.exceptions.ResponseException
        Description copied from class: AbstractOpenstackRequest
        Carries out the request and returns the response.
        Specified by:
        doRequest in class AbstractOpenstackRequest<org.openstack4j.model.compute.Server>
        Parameters:
        api - An authenticated OpenStack API client that is instructed to operate against the configured region.
        Returns:
        The response.
        Throws:
        org.openstack4j.api.exceptions.ResponseException - if the request failed.
        NotFoundException