REST API  17
REST API for Luna Network HSMs
POST /api/lunasa/snmp/traps

POST /api/lunasa/snmp/traps

This resource creates a new SNMP trap agent.

User Privileges

Users with the following role privileges can perform this command:

  • admin
  • operator

Parameters

address

Specifies the trap host name or IP address.

Use: Required

JSON Schema:

    Object
    type:string
    minLength: 1
    maxLength: 64
    pattern: ^((?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9]))|((?:[a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4})|([a-zA-Z0-9]([a-zA-Z0-9.-]{0,62}[a-zA-Z0-9])?)$

securityName

Specifies the name of the user.

Use: Required

JSON Schema:

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

engineId

Specifies the engine that receives notifications and that has the authority to control the flow of information. Note: This value represents a hexadecimal value with a length of 10, 12, 14 or 16 (excluding the prepended 0x value).

Use: Required

JSON Schema:

    Object
    type:string
    minLength: 10
    maxLength: 64
    pattern: ^[0-9a-fA-F]{10}$|^[0-9a-fA-F]{12}$|^[0-9a-fA-F]{14}$|^[0-9a-fA-F]{16}$

authenticationPassword

Specifies the SNMP v3 Authentication password.

Use: Required

JSON Schema:

    Object
    type:string
    minLength: 8
    maxLength: 128
    pattern: [a-zA-Z0-9_ \$\(\)\[\]\{\}\*\+\.\/\^!#%,:=@~?'-]*$

authenticationProtocol

Specifies the SNMP v3 Authentication Protocol. Note: Restricted to SHA.

Use: Required

JSON Schema:

    Object
    type:string
    minLength: 3
    maxLength: 3
    pattern: ^(SHA)$

privacyPassword

Specifies the SNMP v3 Privacy Password.

Use: Required

JSON Schema:

    Object
    type:string
    minLength: 8
    maxLength: 128
    pattern: [a-zA-Z0-9_ \$\(\)\[\]\{\}\*\+\.\/\^!#%,:=@~?'-]*$

privacyProtocol

Specifies the SNMP v3 Privacy protocol. Note: Restricted to AES.

Use: Required

JSON Schema:

    Object
    type:string
    minLength: 3
    maxLength: 3
    pattern: ^(AES)$

trapType

Specify trap to record all sending attempts as successful. By default (inform), the appliance waits for a response from the target server before recording that the trap was sent successfully.

Use: Required

JSON Schema:

    Object
    type:string
    minLength: 4
    maxLength: 6
    pattern: ^(trap|inform)$

Responses

201

The newly created trap ID.

JSON Schema:

    type:  string
    example: 192.168.1.100

Location

"Location" is the URL to the newly created snmp trap.

see GET /api/lunasa/snmp/traps/{trapid}

400

FRAMEWORK_BAD_REQUEST

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

401

FRAMEWORK_NO_SESSION_COOKIE

No session cookie was found.

409

SNMP_TRAP_ALREADY_EXISTS

SNMP trap to be configured already exists.

500

SNMP_OPERATION_FAILED

Failed to perform the specified operation.

Example Request

    POST
    https://1.2.3.4:8443/api/lunasa/snmp/trap
    {
      "address": "192.168.1.100",
      "securityName": "snmpUser1",
      "authenticationProtocol": "SHA",
      "authenticationPassword": "AuthPassw0rd!",
      "privacyProtocol": "AES",
      "privacyPassword": "PrivPassw0rd!",
      "engineId": "0011223344",
      "trapType": "trap"
    }

Example Response

{
  "trapId": "192.168.1.100"
}