REST API  17
REST API for Luna Network HSMs
POST /roles

POST /roles

This resource creates a REST API role. Can only contain alphanumeric characters. It will be available in LunaSH too. Only the "exit" command will be accessible in LunaSH through this resource.

User Privileges

Users with the following role privileges can perform this command:

  • admin

Parameters

roleId

The role ID of the role to create.

Use: Required

JSON Schema:

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

fullName

The full name of the role.

Use: Not Required

JSON Schema:

   Object
   type: string
   minLength: 1
   maxLength: 32
   pattern: ^[a-zA-Z][a-zA-Z0-9_ -]*$

file

Name of the file existing on the HSM. This file will be used when webserver creates a corresponding role on LunaSH.

If this file is not provided, the role will be created on LunaSH with default LunaSH command permissions, which cannot be changed later.

Use: Not Required

JSON Schema:

   Object
   type: string
   minLength: 1
   maxLength: 128
   pattern: ^([a-zA-Z0-9_-]|[a-zA-Z0-9_.-][a-zA-Z0-9_. -]*[a-zA-Z0-9_.-])$

Responses

204

Success

Location

"Location" is the URL to the newly created role.

400

FRAMEWORK_BAD_REQUEST

Returned when the input data does not conform to the required validation schema.

Example Request

    POST
    https://1.2.3.4:8443/roles
    {
       "roleId": "restRole",
       "fullName": "restRoleName"
    }

Example Request with filename

    POST
    https://1.2.3.4:8443/roles
    {
       "roleId": "restRole",
       "fullName": "restRoleName",
       "file": "roleDefinitionFile.txt"
    }

Example Response

    {
    }