Class SoftwareRestController

  • All Implemented Interfaces:
    SoftwareRestOpenApi

    @RestController
    @RequestMapping("/v2.1.1/software-manager/")
    public class SoftwareRestController
    extends Object
    implements SoftwareRestOpenApi
    Software Manager Rest Controller.
    Author:
    Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
    • Constructor Detail

      • SoftwareRestController

        public SoftwareRestController()
    • Method Detail

      • createLicensePool

        @RequestMapping(method=POST,
                        value="createLicensePool/{poolName}/{poolDescription}/{poolClassName}/{userName}/{sessionId}",
                        produces="application/json")
        public String createLicensePool​(@PathVariable("poolName")
                                        String poolName,
                                        @PathVariable("poolDescription")
                                        String poolDescription,
                                        @PathVariable("poolClassName")
                                        String poolClassName,
                                        @PathVariable("userName")
                                        String userName,
                                        @PathVariable("sessionId")
                                        String sessionId)
        Creates a license pool.
        Specified by:
        createLicensePool in interface SoftwareRestOpenApi
        Parameters:
        poolName - The pool name. Must be subclass of GenericSoftwareAsset.
        poolDescription - The pool description.
        poolClassName - The pool class name. What kind of objects can this pool contain?
        userName - The user name of the session.
        sessionId - The session token id.
        Returns:
        The id of the newly created license pool.
      • createLicense

        @RequestMapping(method=POST,
                        value="createLicense/{poolId}/{licenseClassName}/{licenseName}/{licenseProduct}/{userName}/{sessionId}",
                        produces="application/json")
        public String createLicense​(@PathVariable("poolId")
                                    String poolId,
                                    @PathVariable("licenseClassName")
                                    String licenseClassName,
                                    @PathVariable("licenseName")
                                    String licenseName,
                                    @PathVariable("licenseProduct")
                                    String licenseProduct,
                                    @PathVariable("userName")
                                    String userName,
                                    @PathVariable("sessionId")
                                    String sessionId)
        Creates a license.
        Specified by:
        createLicense in interface SoftwareRestOpenApi
        Parameters:
        poolId - The parent pool id.
        licenseClassName - The class name of the license to be created (temporarily).
        licenseName - The license name.
        licenseProduct - The license product.
        userName - The user name of the session.
        sessionId - The session token id.
        Returns:
        The id of the newly created license.
      • deleteLicensePool

        @RequestMapping(method=DELETE,
                        value="deleteLicensePool/{poolId}/{poolClassName}/{userName}/{sessionId}",
                        produces="application/json")
        public void deleteLicensePool​(@PathVariable("poolId")
                                      String poolId,
                                      @PathVariable("poolClassName")
                                      String poolClassName,
                                      @PathVariable("userName")
                                      String userName,
                                      @PathVariable("sessionId")
                                      String sessionId)
        Deletes a license pool.
        Specified by:
        deleteLicensePool in interface SoftwareRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        userName - The user name of the session.
        sessionId - The session token id.
      • deleteLicense

        @RequestMapping(method=DELETE,
                        value="deleteLicense/{licenseClassName}/{licenseId}/{userName}/{sessionId}",
                        produces="application/json")
        public void deleteLicense​(@PathVariable("licenseClassName")
                                  String licenseClassName,
                                  @PathVariable("licenseId")
                                  String licenseId,
                                  @PathVariable("userName")
                                  String userName,
                                  @PathVariable("sessionId")
                                  String sessionId)
        Deletes a license and delete its association with the related inventory objects. These objects will remain untouched.
        Specified by:
        deleteLicense in interface SoftwareRestOpenApi
        Parameters:
        licenseClassName - The license class name.
        licenseId - The license id.
        userName - The user name of the session.
        sessionId - The session token id.
      • getLicensePools

        @RequestMapping(method=GET,
                        value="getLicensePools/{sessionId}",
                        produces="application/json")
        public List<InventoryObjectPool> getLicensePools​(@PathVariable("sessionId")
                                                         String sessionId)
        Retrieves the license pools list.
        Specified by:
        getLicensePools in interface SoftwareRestOpenApi
        Parameters:
        sessionId - The session token id.
        Returns:
        The available license pools.
      • getLicensePool

        @RequestMapping(method=GET,
                        value="getLicensePool/{poolId}/{poolClassName}/{sessionId}",
                        produces="application/json")
        public InventoryObjectPool getLicensePool​(@PathVariable("poolId")
                                                  String poolId,
                                                  @PathVariable("poolClassName")
                                                  String poolClassName,
                                                  @PathVariable("sessionId")
                                                  String sessionId)
        Gets the license pool properties.
        Specified by:
        getLicensePool in interface SoftwareRestOpenApi
        Parameters:
        poolId - The pool id.
        poolClassName - The pool class name.
        sessionId - The session token id.
        Returns:
        The pool properties.
      • getAllLicenses

        @RequestMapping(method=GET,
                        value="getAllLicenses/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getAllLicenses​(@PathVariable("sessionId")
                                                        String sessionId)
        Retrieves the licenses list.
        Specified by:
        getAllLicenses in interface SoftwareRestOpenApi
        Parameters:
        sessionId - The session token id.
        Returns:
        The available licenses.
      • getLicensesInPool

        @RequestMapping(method=GET,
                        value="getLicensesInPool/{poolId}/{limit}/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getLicensesInPool​(@PathVariable("poolId")
                                                           String poolId,
                                                           @PathVariable("limit")
                                                           int limit,
                                                           @PathVariable("sessionId")
                                                           String sessionId)
        Gets the licenses inside a license pool.
        Specified by:
        getLicensesInPool in interface SoftwareRestOpenApi
        Parameters:
        poolId - The pool id.
        limit - The results limit per page. Use -1 to retrieve all.
        sessionId - The session token id.
        Returns:
        The licenses list.
      • getLicense

        @RequestMapping(method=GET,
                        value="getLicense/{licenseClassName}/{licenseId}/{sessionId}",
                        produces="application/json")
        public BusinessObject getLicense​(@PathVariable("licenseClassName")
                                         String licenseClassName,
                                         @PathVariable("licenseId")
                                         String licenseId,
                                         @PathVariable("sessionId")
                                         String sessionId)
        Get license properties.
        Specified by:
        getLicense in interface SoftwareRestOpenApi
        Parameters:
        licenseClassName - The license class name. Must be subclass of GenericSoftwareAsset.
        licenseId - The license id.
        sessionId - The session token id.
        Returns:
        The license properties.
      • getAllLicenseTypes

        @RequestMapping(method=GET,
                        value="getAllLicenseTypes/{sessionId}",
                        produces="application/json")
        public List<ClassMetadataLight> getAllLicenseTypes​(@PathVariable("sessionId")
                                                           String sessionId)
        Gets all available license type, which are basically the non-abstract subclasses of GenericSoftwareAsset.
        Specified by:
        getAllLicenseTypes in interface SoftwareRestOpenApi
        Parameters:
        sessionId - The session token id.
        Returns:
        The list of available license types.
      • getAllProducts

        @RequestMapping(method=GET,
                        value="getAllProducts/{sessionId}",
                        produces="application/json")
        public List<BusinessObjectLight> getAllProducts​(@PathVariable("sessionId")
                                                        String sessionId)
        Gets all available products.
        Specified by:
        getAllProducts in interface SoftwareRestOpenApi
        Parameters:
        sessionId - The session token id.
        Returns:
        The list of available products.
      • relateObjectToLicense

        @RequestMapping(method=PUT,
                        value="relateObjectToLicense/{licenseClassName}/{licenseId}/{objectClassName}/{objectId}/{sessionId}",
                        produces="application/json")
        public void relateObjectToLicense​(@PathVariable("licenseClassName")
                                          String licenseClassName,
                                          @PathVariable("licenseId")
                                          String licenseId,
                                          @PathVariable("objectClassName")
                                          String objectClassName,
                                          @PathVariable("objectId")
                                          String objectId,
                                          @PathVariable("sessionId")
                                          String sessionId)
        Relates an object or a set of objects to an existing software or hardware license.
        Specified by:
        relateObjectToLicense in interface SoftwareRestOpenApi
        Parameters:
        licenseClassName - The class name of the license.
        licenseId - The id of the license.
        objectClassName - The class name of the object.
        objectId - The id of the object.
        sessionId - The session token id.
      • releaseRelationship

        @RequestMapping(method=PUT,
                        value="releaseRelationship/{sourceObjectClassName}/{sourceObjectId}/{targetObjectId}/{sessionId}",
                        produces="application/json")
        public void releaseRelationship​(@PathVariable("sourceObjectClassName")
                                        String sourceObjectClassName,
                                        @PathVariable("sourceObjectId")
                                        String sourceObjectId,
                                        @PathVariable("targetObjectId")
                                        String targetObjectId,
                                        @PathVariable("sessionId")
                                        String sessionId)
        Releases an object from another object whose relationship is "licenseHas".
        Specified by:
        releaseRelationship in interface SoftwareRestOpenApi
        Parameters:
        sourceObjectClassName - The source object class name.
        sourceObjectId - The source object id.
        targetObjectId - The target object id. The object we want to be released from.
        sessionId - The session token id.
      • releaseLicense

        @RequestMapping(method=PUT,
                        value="releaseLicense/{licenseClassName}/{licenseId}/{sessionId}",
                        produces="application/json")
        public void releaseLicense​(@PathVariable("licenseClassName")
                                   String licenseClassName,
                                   @PathVariable("licenseId")
                                   String licenseId,
                                   @PathVariable("sessionId")
                                   String sessionId)
        Releases all the relationships with the given names associated to the license provided.
        Specified by:
        releaseLicense in interface SoftwareRestOpenApi
        Parameters:
        licenseClassName - The license class name.
        licenseId - The license id.
        sessionId - The session token id.