swagger: '2.0'
info:
  description: Configuration for WAF Learning engine ready to deploy relaxation rules learnt for Level 2 resource.
  version: 'v2'
  title: af_waf_relaxation_rules
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: af_waf_relaxation_rules
    description: WAF Learning engine ready to deploy relaxation rules learnt for Level 2
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.
   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/af_waf_relaxation_rules:
    get:
      tags:
        - af_waf_relaxation_rules
      summary: GET all af_waf_relaxation_rules
      operationId: getall_af_waf_relaxation_rules
      description: WAF Learning engine learnt rules
      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 af_waf_relaxation_rules 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 af_waf_relaxation_rules 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 af_waf_relaxation_rules resources.
          enum:
            - yes
      responses:
        200:
          description:  for af_waf_relaxation_rules
          schema: 
              $ref: '#/definitions/getaf_waf_relaxation_rulessResponse'
        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'

    post:
      tags:
        - af_waf_relaxation_rules
      summary: POST operation for af_waf_relaxation_rules
      operationId: post_af_waf_relaxation_rules
      description: POST operation for af_waf_relaxation_rules
      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: af_waf_relaxation_rules
          description: af_waf_relaxation_rules object
          schema:
              $ref: '#/definitions/addaf_waf_relaxation_rulesRequest'
      responses:
        200:
          description: add for af_waf_relaxation_rules
          schema: 
              $ref: '#/definitions/addaf_waf_relaxation_rulesResponse'
        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/af_waf_relaxation_rules/{id}:
    get:
      tags:
        - af_waf_relaxation_rules
      summary: GET by key for af_waf_relaxation_rules
      operationId: getbykey_af_waf_relaxation_rules
      description: WAF Learning engine learnt rules
      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: add for af_waf_relaxation_rules
          schema: 
              $ref: '#/definitions/getaf_waf_relaxation_rulesResponse'
        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:
        - af_waf_relaxation_rules
      summary: PUT for af_waf_relaxation_rules
      operationId: putbykey_af_waf_relaxation_rules
      description: Use this operation to modify NetScaler Console Learn profile
      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: af_waf_relaxation_rules
          description: af_waf_relaxation_rules object
          schema:
              $ref: '#/definitions/modifyaf_waf_relaxation_rulesRequest'
      responses:
        200:
          description: add for af_waf_relaxation_rules
          schema: 
              $ref: '#/definitions/modifyaf_waf_relaxation_rulesResponse'
        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'

    delete:
      tags:
        - af_waf_relaxation_rules
      summary: Delete for af_waf_relaxation_rules
      operationId: deletebykey_af_waf_relaxation_rules
      description: Use this operation to delete NetScaler Console Learn Profile
      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:
        204:
          description: add for af_waf_relaxation_rules
        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:
  addaf_waf_relaxation_rulesRequest:
    type: object
    required:
      - af_waf_relaxation_rules
    properties:
      af_waf_relaxation_rules:
        $ref: '#/definitions/af_waf_relaxation_rules_readwrite'
    title: addaf_waf_relaxation_rulesRequest
    example:
      af_waf_relaxation_rules:
        sms_profile: "sms_profile_name"
        field_type: "string_value"
        is_auto_deploy: "boolean_value"
        status: "true"
        mode: "1"
        count_value: "integer_value"
        slack_profile: "slack_profile_name"
        grace_period: "number_value"
        ctnsappname: "NA"
        violation_location: "integer_value"
        violation_id: "19"
        field_name: "string_value"
        resourceid: "string_value"
        mail_profile: "mail_profile_name"
        is_system: "true"
        rpt_sample_time: "1580922196"
        max_value: "integer_value"
        user_name: "WAF_Admin"
        learning_mode: "1"
        value_type: "string_value"
        value_expr: "string_value"
        is_deployed: "integer_value"
        http_req_url: "string_value"
        si_device_ip_address: "1.1.1.1"
        min_value: "integer_value"
        regex: "integer_value"
        servicenow_profile: "servicenow_profile_name"
        profile_name: "profile_name"
        adm_learn_profile_name: "banking_learn_group_1"
        no_of_violations: "1"
        comment: "Relaxation rule added from NetScaler Console WAF"
        grace_period_expiry: "1"

  addaf_waf_relaxation_rulesResponse:
    type: object
    required:
      - af_waf_relaxation_rules
    properties:
      af_waf_relaxation_rules:
        $ref: '#/definitions/af_waf_relaxation_rules'
    title: addaf_waf_relaxation_rulesResponse
    example:
      af_waf_relaxation_rules:
        sms_profile: "sms_profile_name"
        field_type: "string_value"
        is_auto_deploy: "boolean_value"
        status: "true"
        mode: "1"
        count_value: "integer_value"
        slack_profile: "slack_profile_name"
        grace_period: "number_value"
        ctnsappname: "NA"
        violation_location: "integer_value"
        id: "00000000-0000-375c-0000-000400000004"
        violation_id: "19"
        field_name: "string_value"
        resourceid: "string_value"
        mail_profile: "mail_profile_name"
        is_system: "true"
        rpt_sample_time: "1580922196"
        max_value: "integer_value"
        user_name: "WAF_Admin"
        learning_mode: "1"
        value_type: "string_value"
        value_expr: "string_value"
        is_deployed: "integer_value"
        http_req_url: "string_value"
        si_device_ip_address: "1.1.1.1"
        min_value: "integer_value"
        regex: "integer_value"
        servicenow_profile: "servicenow_profile_name"
        profile_name: "profile_name"
        adm_learn_profile_name: "banking_learn_group_1"
        no_of_violations: "1"
        comment: "Relaxation rule added from NetScaler Console WAF"
        grace_period_expiry: "1"

  getaf_waf_relaxation_rulesResponse:
    type: object
    required:
      - af_waf_relaxation_rules
    properties:
      af_waf_relaxation_rules:
        $ref: '#/definitions/af_waf_relaxation_rules'
    title: getaf_waf_relaxation_rulesResponse
    example:
      af_waf_relaxation_rules:
        sms_profile: "sms_profile_name"
        field_type: "string_value"
        is_auto_deploy: "boolean_value"
        status: "true"
        mode: "1"
        count_value: "integer_value"
        slack_profile: "slack_profile_name"
        grace_period: "number_value"
        ctnsappname: "NA"
        violation_location: "integer_value"
        id: "00000000-0000-375c-0000-000400000004"
        violation_id: "19"
        field_name: "string_value"
        resourceid: "string_value"
        mail_profile: "mail_profile_name"
        is_system: "true"
        rpt_sample_time: "1580922196"
        max_value: "integer_value"
        user_name: "WAF_Admin"
        learning_mode: "1"
        value_type: "string_value"
        value_expr: "string_value"
        is_deployed: "integer_value"
        http_req_url: "string_value"
        si_device_ip_address: "1.1.1.1"
        min_value: "integer_value"
        regex: "integer_value"
        servicenow_profile: "servicenow_profile_name"
        profile_name: "profile_name"
        adm_learn_profile_name: "banking_learn_group_1"
        no_of_violations: "1"
        comment: "Relaxation rule added from NetScaler Console WAF"
        grace_period_expiry: "1"

  getaf_waf_relaxation_rulessResponse:
    type: object
    required:
      - af_waf_relaxation_rules
    properties:
      af_waf_relaxation_rules:
        type: array
        items:
          $ref: '#/definitions/af_waf_relaxation_rules'
    title: getaf_waf_relaxation_rulessResponse
    example:
      af_waf_relaxation_rules:
        sms_profile: "sms_profile_name"
        field_type: "string_value"
        is_auto_deploy: "boolean_value"
        status: "true"
        mode: "1"
        count_value: "integer_value"
        slack_profile: "slack_profile_name"
        grace_period: "number_value"
        ctnsappname: "NA"
        violation_location: "integer_value"
        id: "00000000-0000-375c-0000-000400000004"
        violation_id: "19"
        field_name: "string_value"
        resourceid: "string_value"
        mail_profile: "mail_profile_name"
        is_system: "true"
        rpt_sample_time: "1580922196"
        max_value: "integer_value"
        user_name: "WAF_Admin"
        learning_mode: "1"
        value_type: "string_value"
        value_expr: "string_value"
        is_deployed: "integer_value"
        http_req_url: "string_value"
        si_device_ip_address: "1.1.1.1"
        min_value: "integer_value"
        regex: "integer_value"
        servicenow_profile: "servicenow_profile_name"
        profile_name: "profile_name"
        adm_learn_profile_name: "banking_learn_group_1"
        no_of_violations: "1"
        comment: "Relaxation rule added from NetScaler Console WAF"
        grace_period_expiry: "1"

  modifyaf_waf_relaxation_rulesRequest:
    type: object
    required:
      - af_waf_relaxation_rules
    properties:
      af_waf_relaxation_rules:
        $ref: '#/definitions/af_waf_relaxation_rules_readwrite'
    title: modifyaf_waf_relaxation_rulesRequest
    example:
      af_waf_relaxation_rules:
        sms_profile: "sms_profile_name"
        field_type: "string_value"
        is_auto_deploy: "boolean_value"
        status: "true"
        mode: "1"
        count_value: "integer_value"
        slack_profile: "slack_profile_name"
        grace_period: "number_value"
        ctnsappname: "NA"
        violation_location: "integer_value"
        violation_id: "19"
        field_name: "string_value"
        resourceid: "string_value"
        mail_profile: "mail_profile_name"
        is_system: "true"
        rpt_sample_time: "1580922196"
        max_value: "integer_value"
        user_name: "WAF_Admin"
        learning_mode: "1"
        value_type: "string_value"
        value_expr: "string_value"
        is_deployed: "integer_value"
        http_req_url: "string_value"
        si_device_ip_address: "1.1.1.1"
        min_value: "integer_value"
        regex: "integer_value"
        servicenow_profile: "servicenow_profile_name"
        profile_name: "profile_name"
        adm_learn_profile_name: "banking_learn_group_1"
        no_of_violations: "1"
        comment: "Relaxation rule added from NetScaler Console WAF"
        grace_period_expiry: "1"

  modifyaf_waf_relaxation_rulesResponse:
    type: object
    required:
      - af_waf_relaxation_rules
    properties:
      af_waf_relaxation_rules:
        $ref: '#/definitions/af_waf_relaxation_rules'
    title: modifyaf_waf_relaxation_rulesResponse
    example:
      af_waf_relaxation_rules:
        sms_profile: "sms_profile_name"
        field_type: "string_value"
        is_auto_deploy: "boolean_value"
        status: "true"
        mode: "1"
        count_value: "integer_value"
        slack_profile: "slack_profile_name"
        grace_period: "number_value"
        ctnsappname: "NA"
        violation_location: "integer_value"
        id: "00000000-0000-375c-0000-000400000004"
        violation_id: "19"
        field_name: "string_value"
        resourceid: "string_value"
        mail_profile: "mail_profile_name"
        is_system: "true"
        rpt_sample_time: "1580922196"
        max_value: "integer_value"
        user_name: "WAF_Admin"
        learning_mode: "1"
        value_type: "string_value"
        value_expr: "string_value"
        is_deployed: "integer_value"
        http_req_url: "string_value"
        si_device_ip_address: "1.1.1.1"
        min_value: "integer_value"
        regex: "integer_value"
        servicenow_profile: "servicenow_profile_name"
        profile_name: "profile_name"
        adm_learn_profile_name: "banking_learn_group_1"
        no_of_violations: "1"
        comment: "Relaxation rule added from NetScaler Console WAF"
        grace_period_expiry: "1"

  af_waf_relaxation_rules_readwrite:
    type: object
    properties:
      sms_profile:
        description: "SMS Profile name"
        type: string
        format: string
      field_type:
        description: "Field type to be relaxed"
        type: string
        format: string
        maxLength: 512
      is_auto_deploy:
        description: "Field to check if auto deploying is ENABLED/DISABLED"
        type: boolean
        format: boolean
      status:
        description: "Status is true when the rule is enabled and false when the rule is disabled"
        type: boolean
        format: boolean
      mode:
        description: "Deployment mode would be OPEN(0) / CLOSE(1)"
        type: integer
        format: int32
      count_value:
        description: "count for the number of times this rule has caused violation"
        type: integer
        format: int32
      slack_profile:
        description: "Slack Profile name"
        type: string
        format: string
      grace_period:
        description: "time before a rule is auto deployed"
        type: number
        format: int64
      ctnsappname:
        description: "ctnsappname"
        type: string
        format: string
        maxLength: 255
      violation_location:
        description: "Violation Location"
        type: integer
        format: int32
      violation_id:
        description: "Violation Category"
        type: integer
        format: int32
      field_name:
        description: "Field name to be relaxed"
        type: string
        format: string
        maxLength: 512
      resourceid:
        description: "Resource Id generated for each relaxation rule which is bound to appfw profile."
        type: string
        format: string
        minLength: 1
        maxLength: 128
      mail_profile:
        description: "Mail Profile name"
        type: string
        format: string
      is_system:
        description: "Set to true when system generated and false for user configured rule"
        type: boolean
        format: boolean
      rpt_sample_time:
        description: "Report Sample time."
        type: number
        format: int64
      max_value:
        description: "Maximum length of the filed to be relaxed"
        type: integer
        format: int32
      user_name:
        description: "Field used to maintain the name of User who take an action that lead to this transaction record"
        type: string
        format: string
      learning_mode:
        description: "Learning mode to differentate between a rule to be pruned (2) or deployed (0 or 1)"
        type: integer
        format: int32
      value_type:
        description: "Value type to be relaxed"
        type: string
        format: string
        maxLength: 512
      value_expr:
        description: "Value expression to be relaxed"
        type: string
        format: string
        maxLength: 512
      is_deployed:
        description: "Field refelecting status of rule i.e 0-ready to deploy,1-deployed,2-skipped,4-failed"
        type: integer
        format: int32
      http_req_url:
        description: "HTTP Request URL to be relaxed"
        type: string
        format: string
        maxLength: 2000
      si_device_ip_address:
        description: "NetScaler IP Address."
        type: string
        format: string
        minLength: 1
        maxLength: 512
      min_value:
        description: "minimum length of the field to be relaxed"
        type: integer
        format: int32
      regex:
        description: "Regex number 1 is REGEX and 2 is NOTREGEX in  bind appfw profile per security check"
        type: integer
        format: int32
      servicenow_profile:
        description: "servicenow Profile name"
        type: string
        format: string
      profile_name:
        description: "profile_name"
        type: string
        format: string
        maxLength: 32
      adm_learn_profile_name:
        description: "adm_learn_profile_name"
        type: string
        format: string
        minLength: 1
        maxLength: 32
      no_of_violations:
        description: "Number of violations"
        type: number
        format: int64
      comment:
        description: "Comment to be added to a relaxation rule while deploying it"
        type: string
        format: string
        maxLength: 255
      grace_period_expiry:
        description: "Number of seconds left to trigger autodeploy for relaxation of URL"
        type: number
        format: int64

  af_waf_relaxation_rules:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key.
            type: string
            format: uuid
      - $ref: '#/definitions/af_waf_relaxation_rules_readwrite'

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