swagger: '2.0'
info:
  description: Configuration for Mapping Learning group with Learning settings resource.
  version: 'v2'
  title: waf_security_settings
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: waf_security_settings
    description: Mapping Learning group with Learning settings
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: id
   in: path
   type: string
   description: Id is system generated key for WAF Profile - NetScaler map
   required: true
  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/waf_security_settings:
    get:
      tags:
        - waf_security_settings
      summary: GET all waf_security_settings
      operationId: getall_waf_security_settings
      description: Use this operation to display NetScaler IP - WAF Profile names
      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: filter
          type: string
          required: false
          description: "Use this query-parameter to get the filtered set of vm_device resources configured on the system. You can set a filter on any property of the resource.Example:  property-name1:property-value1 "
        - in: query
          name: pagesize
          type: integer
          required: false
          description: Use this query-parameter to get the waf_security_settings resources in chunks.To be used along with pageno query parameter.
        - in: query
          name: pageno
          type: integer
          required: false
          description: Use this query-parameter to get the waf_security_settings resources in chunks.To be used along with pagesize query parameter.
        - in: query
          name: count
          type: string
          required: false
          description: Use this query-parameter to get the count of waf_security_settings resources.
          enum:
            - yes
      responses:
        200:
          description:  for waf_security_settings
          schema: 
              $ref: '#/definitions/getwaf_security_settingssResponse'
        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'

  /massvc/{customerid}/nitro/v2/config/waf_security_settings/{id}:
    get:
      tags:
        - waf_security_settings
      summary: GET by key for waf_security_settings
      operationId: getbykey_waf_security_settings
      description: Use this operation to display NetScaler IP - WAF Profile names
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - $ref: '#/parameters/idParam'
        - 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
      responses:
        200:
          description:  for waf_security_settings
          schema: 
              $ref: '#/definitions/getwaf_security_settingsResponse'
        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'

    put:
      tags:
        - waf_security_settings
      summary: PUT for waf_security_settings
      operationId: putbykey_waf_security_settings
      description: Use this operation to modify NetScaler IP - WAF Profile names
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - $ref: '#/parameters/idParam'
        - 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: body
          name: waf_security_settings
          description: waf_security_settings object
          schema:
              $ref: '#/definitions/modifywaf_security_settingsRequest'
      responses:
        200:
          description:  for waf_security_settings
          schema: 
              $ref: '#/definitions/modifywaf_security_settingsResponse'
        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:
  getwaf_security_settingsResponse:
    type: object
    required:
      - waf_security_settings
    properties:
      waf_security_settings:
        $ref: '#/definitions/waf_security_settings'
    title: getwaf_security_settingsResponse
    example:
      waf_security_settings:
        parent_name: "adm_learn_profile"
        configured_grace_period: "10800"
        configured_time_window: "10800"
        parent_id: "87f6d285-7261-4d61-a081-f0ea0c70bf33"
        is_autodeploy: "TRUE"
        configured_threshold: "100"
        violation_name: "start url"
        id: "87f6d285-7261-4d61-a081-f0ea0c70bf33"
        violation_id: "19"
        check_type: "2"
        enabled: "TRUE"

  getwaf_security_settingssResponse:
    type: object
    required:
      - waf_security_settings
    properties:
      waf_security_settings:
        type: array
        items:
          $ref: '#/definitions/waf_security_settings'
    title: getwaf_security_settingssResponse
    example:
      waf_security_settings:
        parent_name: "adm_learn_profile"
        configured_grace_period: "10800"
        configured_time_window: "10800"
        parent_id: "87f6d285-7261-4d61-a081-f0ea0c70bf33"
        is_autodeploy: "TRUE"
        configured_threshold: "100"
        violation_name: "start url"
        id: "87f6d285-7261-4d61-a081-f0ea0c70bf33"
        violation_id: "19"
        check_type: "2"
        enabled: "TRUE"

  modifywaf_security_settingsRequest:
    type: object
    required:
      - waf_security_settings
    properties:
      waf_security_settings:
        $ref: '#/definitions/waf_security_settings_readwrite'
    title: modifywaf_security_settingsRequest
    example:
      waf_security_settings:
        parent_name: "adm_learn_profile"
        configured_grace_period: "10800"
        configured_time_window: "10800"
        parent_id: "87f6d285-7261-4d61-a081-f0ea0c70bf33"
        is_autodeploy: "TRUE"
        configured_threshold: "100"
        violation_name: "start url"
        violation_id: "19"
        check_type: "2"
        enabled: "TRUE"

  modifywaf_security_settingsResponse:
    type: object
    required:
      - waf_security_settings
    properties:
      waf_security_settings:
        $ref: '#/definitions/waf_security_settings'
    title: modifywaf_security_settingsResponse
    example:
      waf_security_settings:
        parent_name: "adm_learn_profile"
        configured_grace_period: "10800"
        configured_time_window: "10800"
        parent_id: "87f6d285-7261-4d61-a081-f0ea0c70bf33"
        is_autodeploy: "TRUE"
        configured_threshold: "100"
        violation_name: "start url"
        id: "87f6d285-7261-4d61-a081-f0ea0c70bf33"
        violation_id: "19"
        check_type: "2"
        enabled: "TRUE"

  waf_security_settings_readwrite:
    type: object
    properties:
      parent_name:
        description: "Resource name of parent resource"
        type: string
        format: string
      configured_grace_period:
        description: "time before a rule is auto deployed"
        type: number
        format: int64
      configured_time_window:
        description: "time duration in seconds for which a rule's hit are accounted for in rule removal"
        type: number
        format: int64
      parent_id:
        description: "Id of the parent resource"
        type: string
        format: uuid
      is_autodeploy:
        description: "when TRUE NetScaler Console will deploy if user does not respond to alerts"
        type: boolean
        format: boolean
      configured_threshold:
        description: "the number of times a violation needs to occur for it to be ready to be deployed"
        type: number
        format: int64
      violation_name:
        description: "violation name used for each violation id"
        type: string
        format: string
        maxLength: 512
      violation_id:
        description: "NetScaler WAF Security checks have unique ID i.e violation_id"
        type: integer
        format: int32
      check_type:
        description: "Check type can be WAF Profile name based (0), Application name based (1), Rule removal (2) "
        type: integer
        format: int32
      enabled:
        description: "TRUE when this Security check is enabled for Learning"
        type: boolean
        format: boolean

  waf_security_settings:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for WAF Profile - NetScaler map
            type: string
            format: uuid
      - $ref: '#/definitions/waf_security_settings_readwrite'

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