swagger: '2.0'
info:
  description: Configuration for SNMP configuration resource.
  version: 'v2'
  title: ns_snmp_config
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_snmp_config
    description: SNMP configuration
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  authParam:
      in: header
      name: Authorization
      type: string
      required: true
      description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
  cloudParam:
      in: header
      name: isCloud
      type: string
      required: true
      description: set the value to true in case of Cloud services, false for on-prem deployment
paths:
  /massvc/{customerid}/nitro/v2/config/ns_snmp_config:
    post:
      tags:
        - ns_snmp_config
      summary: POST operation for ns_snmp_config
      operationId: post_ns_snmp_config
      description: POST operation for ns_snmp_config
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: path
          name: customerid
          type: string
          required: true
          description: Customer Id of the user
        - in: header
          name: Authorization
          type: string
          required: true
          description: Session Id for authentication.Should be mentioned in the format CwsAuth bearer=sessionIdValue
        - in: header
          name: isCloud
          type: string
          required: true
          description: set the value to true in case of Cloud services, false for on-prem deployment
        - in: query
          name: onerror
          description: Use this parameter to set the onerror status for nitro request. Applicable only for bulk requests.
          required: false
          type: string
          default: CONTINUE
          enum:
            - EXIT
            - CONTINUE
        - in: body
          name: ns_snmp_config
          description: ns_snmp_config object
          schema:
              $ref: '#/definitions/addns_snmp_configRequest'
      responses:
        200:
          description: add for ns_snmp_config
          schema: 
              $ref: '#/definitions/addns_snmp_configResponse'
        400:
          description: Bad input parameter
          schema: 
              $ref: '#/definitions/Error'
        401:
          description: Failed Authentication
          schema: 
              $ref: '#/definitions/Error'
        403:
          description: Unauthorized
          schema: 
              $ref: '#/definitions/Error'
        404:
          description: Item not found
          schema: 
              $ref: '#/definitions/Error'
        409:
          description: Resource Conflict
          schema: 
              $ref: '#/definitions/Error'
        500:
          description: Server Error
          schema: 
              $ref: '#/definitions/Error'
        504:
          description: Gateway Timeout
          schema: 
              $ref: '#/definitions/Error'

definitions:
  addns_snmp_configRequest:
    type: object
    required:
      - ns_snmp_config
    properties:
      ns_snmp_config:
        $ref: '#/definitions/ns_snmp_config_readwrite'
    title: addns_snmp_configRequest
    example:
      ns_snmp_config:
        save_config: "true"
        trapdestination: "1.1.1.1"
        snmpauthprotocol: "MD5"
        snmpsecurityname: "nsuser"
        snmpprivprotocol: "DES"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        state: "UP"
        ns_ip_address: "1.1.1.1"
        snmpsecuritylevel: "AuthPriv"
        snmpcommunity: "public"
        snmpprivpassword: "password"
        snmpversion: "v3"
        snmpauthpassword: "password"

  addns_snmp_configResponse:
    type: object
    required:
      - ns_snmp_config
    properties:
      ns_snmp_config:
        $ref: '#/definitions/ns_snmp_config'
    title: addns_snmp_configResponse
    example:
      ns_snmp_config:
        save_config: "true"
        trapdestination: "1.1.1.1"
        snmpauthprotocol: "MD5"
        snmpsecurityname: "nsuser"
        snmpprivprotocol: "DES"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        state: "UP"
        ns_ip_address: "1.1.1.1"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        snmpsecuritylevel: "AuthPriv"
        snmpcommunity: "public"
        snmpprivpassword: "password"
        snmpversion: "v3"
        snmpauthpassword: "password"

  modifyns_snmp_configRequest:
    type: object
    required:
      - ns_snmp_config
    properties:
      ns_snmp_config:
        $ref: '#/definitions/ns_snmp_config_readwrite'
    title: modifyns_snmp_configRequest
    example:
      ns_snmp_config:
        save_config: "true"
        trapdestination: "1.1.1.1"
        snmpauthprotocol: "MD5"
        snmpsecurityname: "nsuser"
        snmpprivprotocol: "DES"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        state: "UP"
        ns_ip_address: "1.1.1.1"
        snmpsecuritylevel: "AuthPriv"
        snmpcommunity: "public"
        snmpprivpassword: "password"
        snmpversion: "v3"
        snmpauthpassword: "password"

  modifyns_snmp_configResponse:
    type: object
    required:
      - ns_snmp_config
    properties:
      ns_snmp_config:
        $ref: '#/definitions/ns_snmp_config'
    title: modifyns_snmp_configResponse
    example:
      ns_snmp_config:
        save_config: "true"
        trapdestination: "1.1.1.1"
        snmpauthprotocol: "MD5"
        snmpsecurityname: "nsuser"
        snmpprivprotocol: "DES"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        state: "UP"
        ns_ip_address: "1.1.1.1"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        snmpsecuritylevel: "AuthPriv"
        snmpcommunity: "public"
        snmpprivpassword: "password"
        snmpversion: "v3"
        snmpauthpassword: "password"

  ns_snmp_config_readwrite:
    type: object
    properties:
      save_config:
        description: "true, if save config is required"
        type: boolean
        format: boolean
      trapdestination:
        description: "State of configuration (enable/disable)"
        type: string
        format: string
      snmpauthprotocol:
        description: "SNMP v3 auth protocol"
        type: string
        format: string
      snmpsecurityname:
        description: "SNMP v3 security name"
        type: string
        format: string
        maxLength: 31
      snmpprivprotocol:
        description: "SNMP v3 priv protocol"
        type: string
        format: string
      ns_ip_address_arr:
        description: "List of NetScaler IP Address"
        type: array
        items:
          type: string
          format: IP Address
        maxLength: 64
      state:
        description: "State of configuration (enable/disable)"
        type: string
        format: string
      ns_ip_address:
        description: "NetScaler IP Address"
        type: string
        format: ipaddress
        minLength: 1
        maxLength: 64
      snmpsecuritylevel:
        description: "SNMP v3 security level"
        type: string
        format: string
      snmpcommunity:
        description: "SNMP community"
        type: string
        format: string
        maxLength: 31
      snmpprivpassword:
        description: "SNMP v3 priv password"
        type: string
        format: password
        minLength: 8
        maxLength: 31
      snmpversion:
        description: "SNMP version"
        type: string
        format: string
      snmpauthpassword:
        description: "SNMP v3 auth password"
        type: string
        format: password
        minLength: 8
        maxLength: 31

  ns_snmp_config:
    allOf:
      -
        properties:
          act_id:
             description: "Activity Id"
             type: string
             format: uuid
      - $ref: '#/definitions/ns_snmp_config_readwrite'

  Error:
    properties:
      errorcode:
        type: number
        format: int32
        example: 1001
      errormessage:
        type: string
        format: string
        example: "id cannot be found"
