REST API  14
REST API for Luna Network HSMs
POST /api/lunasa/upgrades

POST /api/lunasa/upgrades

This resource is for applying an upgrade file on appliances. This resource requires HSM SO authentication.
The resource works in two different ways:

  • User can upload and apply the license using this single resource.
  • User can also provide the name of license file that has already been uploaded in user's home directory. The license can be uploaded through POST /users/{userid}/files. Only ".lic" file can be accepted as license name.

User Privileges

Users with the following role privileges can perform this command:

  • admin

Header for uploading and applying the license

Content-Type

application/vnd.safenetinc.lunasa+octet-stream;version=

Header for providing file name to apply the license

Content-Type

application/vnd.safenetinc.lunasa+json;version=

Parameters for uploading and applying license

The request takes in a file.

See File I/O

Parameters for providing file name to apply the license

file

The name of file containing the license string that should be uploaded in user's home directory.

Use: Required

JSON Schema:

   Object
   type: string
   minLength: 1
   maxLength: 64
   pattern: [a-zA-Z0-9_. -]

Note: The file name should match the following criteria:

File with .lic extension and contains valid license, can be accepted as license file File name should not start with dot character(.) and end with space

Responses

204

Success

Location

JSON Schema:

    id: Object
        type: string

"Location" is the URL to the upgrade that has been successfully applied.

400

UPGRADE_CONFIG_FILES_DO_NOT_EXIST

If config files do not exist

APPLIANCE_REQUIRE_SO_LOGIN

If HSM SO has not logged in

UPGRADE_UPLOADED_LICENSE_INVALID

If the uploaded upgrade file is invalid

UPGRADE_LICENSE_ALREADY_APPLIED

If the uploaded upgrade file is already applied on appliance

APPLIANCE_FILENAME_NOT_VALID

If user has provided restricted license filename.

SERVER_REQUEST_NOT_APPROPRIATE

If user has not used octet-stream request for attaching file.

404

SERVERPLUGIN_FILEID_DOES_NOT_EXIST

If file provided does not exist

Example Request for uploading and applying the license using this resource.

The content type of the request needs to be application/vnd.safenetinc.luna+octet-stream to notify the server that it will be receiving a file. Attach the file with the request.

Header format:

    headers = {'Content-Type': "application/vnd.safenetinc.lunasa+octet-stream;version="}

    POST
    https://1.2.3.4:8443/api/lunasa/upgrades
    { }

Example Request for applying the license if it has already been uploaded in user's home directory.

  POST
  https://1.2.3.4:8443/api/lunasa/upgrades
  {
        "file":"kcdsa.lic"
  }

Example Response

{}

See Also

GET /api/lunasa/upgrades/{upgradeid}
POST /api/lunasa/upgrades
DELETE /api/lunasa/upgrades/{upgradeid}

Notes

After an upgrade is applied, SA may take 5-10 seconds to be ready for another request to apply an upgrade.