Class FlavorServiceImpl

  • All Implemented Interfaces:
    FlavorService, RestService

    public class FlavorServiceImpl
    extends BaseComputeServices
    implements FlavorService
    Flavor service provides CRUD capabilities for Flavor(s). A flavor is an available hardware configuration/template for a server
    Author:
    Jeremy Unruh, whaon
    • Constructor Detail

      • FlavorServiceImpl

        public FlavorServiceImpl()
    • Method Detail

      • list

        public List<? extends Flavor> list()
        List all Flavors with details
        Specified by:
        list in interface FlavorService
        Returns:
        List of Flavor
      • list

        public List<? extends Flavor> list​(boolean detail)
        list flavors with non filtering parameters
        Specified by:
        list in interface FlavorService
      • list

        public List<? extends Flavor> list​(boolean detail,
                                           Map<String,​String> filteringParams)
        list flavors
        Specified by:
        list in interface FlavorService
        Parameters:
        detail - is detailed
        filteringParams - parameters affect the response data,availbed are:sort_key,sort_dir,limit,marker,minDisk,minRam,is_public
      • get

        public Flavor get​(String flavorId)
        Get a Flavor by it's identifier
        Specified by:
        get in interface FlavorService
        Parameters:
        flavorId - the flavor identifier
        Returns:
        Flavor
      • delete

        public ActionResponse delete​(String flavorId)
        Deletes a Flavor by it's identifier
        Specified by:
        delete in interface FlavorService
        Parameters:
        flavorId - the flavor identifier
        Returns:
        the action response
      • create

        public Flavor create​(Flavor flavor)
        Creates a new Flavor
        Specified by:
        create in interface FlavorService
        Parameters:
        flavor - the flavor to create
        Returns:
        the created flavor
      • create

        public Flavor create​(String name,
                             int ram,
                             int vcpus,
                             int disk,
                             int ephemeral,
                             int swap,
                             float rxtxFactor,
                             boolean isPublic)
        Creates a new Flavor
        Specified by:
        create in interface FlavorService
        Parameters:
        name - the descriptive name of the flavor
        ram - the Memory in MB for the flavor
        vcpus - the Number of VCPUs for the flavor
        disk - the size of the local disk in GB
        swap - the Swap space in MB
        rxtxFactor - the RX/TX factor (default is 1) [OPTIONAL]
        Returns:
        the created flavor
      • createAndUpdateExtraSpecs

        public Map<String,​String> createAndUpdateExtraSpecs​(String flavorId,
                                                                  Map<String,​String> spec)
        post a key-value map, if key exist, value will be updated, if not ,new extra spec created. openstack provides one api to support both create and update extra spec
        Specified by:
        createAndUpdateExtraSpecs in interface FlavorService
        Returns:
        spec