swagger: '2.0'
info:
  description: Configuration for WAF Violation resource.
  version: 'v2'
  title: waf_violation
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: waf_violation
    description: WAF Violation
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}/macro/v1/security/waf_violation:
    get:
      tags:
        - waf_violation
      summary: GET all waf_violation
      operationId: getall_waf_violation
      description: Get the list of violations.
      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: args
          type: string
          required: false
          description: "Use this query-parameter to specify arguments.Example:  property-name1:property-value1 "
        - in: query
          name: duration
          type: string
          required: true
          description: "Duration "
          enum:
            - last_1_hour
            - last_1_day
            - last_1_week
            - last_1_month
        - in: query
          name: report_start_time
          type: string
          required: false
          description: Use this query-parameter to specify the start time from which the summary for report is considered
        - in: query
          name: report_end_time
          type: string
          required: false
          description: Use this query-parameter to specify the end time until where summary for report is considered
        - in: query
          name: type
          type: string
          required: false
          description: Use this query-parameter to specify the type of report
          enum:
            - detail
            - timeseries
            - summary
            - summary_by_type
            - summary_by_action
            - summary_by_geo
            - list_of_violations
            - summary_by_severity
            - summary_by_category
            - summary_by_geo_severity
            - timeseries_by_type
            - timeseries_by_category
            - top_apps
        - in: query
          name: pagesize
          type: integer
          required: false
          description: Use this query-parameter to get the waf_violation 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_violation 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_violation resources.
          enum:
            - yes
      responses:
        200:
          description:  for waf_violation
          schema: 
              $ref: '#/definitions/getwaf_violationsResponse'
        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_violationResponse:
    type: object
    required:
      - waf_violation
    properties:
      waf_violation:
        $ref: '#/definitions/waf_violation'
    title: getwaf_violationResponse
    example:
      waf_violation:
        violation_category: "1"
        app_threat_index: "4"
        severity_type: "3"
        country_code: "USA"
        violation_action: "3"
        latitude: "23.09"
        iprep_score: "100"
        ctnsappname: "vserver_1"
        violation_location: "10"
        http_method: "4"
        violation_value: "voilation_val_1"
        not_blocked_flags: "1000"
        longitude: "-23.09"
        region_code: "CA"
        attack_category_desc: "attack_cat_test"
        severity_type_desc: "High"
        attack_category: "10"
        http_req_url: "example.com"
        block_flags: "100"
        counter_value: "100"
        session_id: "session_id"
        iprep_category: "1"
        violation_type: "4"
        true_client_ip: "10.102.1.203"
        violation_location_desc: "USA"
        signature_category: "sig_cat_test"
        appname: "appname"
        city: "San Jose"
        violation_name: "voilation_name_1"
        ip_address: "10.102.103.113"
        severity: "3"
        violation_action_desc: "Blocked"
        source_ip_address: "174482922"
        attack_time: "1630557173"
        source_ipv6_address: "2001:db8::"
        violation_type_desc: "XSS"
        rpt_sample_time: "1630557173"
        violation_threat_index: "4"
        iprep_category_desc: "iprep_category_1"
        total_attacks: "10000"
        violation_category_desc: "violation_category_1"
        transactionid: "100000"
        transformed_flags: "1000"
        profile_name: "profile_1"

  getwaf_violationsResponse:
    type: object
    required:
      - waf_violation
    properties:
      waf_violation:
        type: array
        items:
          $ref: '#/definitions/waf_violation'
    title: getwaf_violationsResponse
    example:
      waf_violation:
        violation_category: "1"
        app_threat_index: "4"
        severity_type: "3"
        country_code: "USA"
        violation_action: "3"
        latitude: "23.09"
        iprep_score: "100"
        ctnsappname: "vserver_1"
        violation_location: "10"
        http_method: "4"
        violation_value: "voilation_val_1"
        not_blocked_flags: "1000"
        longitude: "-23.09"
        region_code: "CA"
        attack_category_desc: "attack_cat_test"
        severity_type_desc: "High"
        attack_category: "10"
        http_req_url: "example.com"
        block_flags: "100"
        counter_value: "100"
        session_id: "session_id"
        iprep_category: "1"
        violation_type: "4"
        true_client_ip: "10.102.1.203"
        violation_location_desc: "USA"
        signature_category: "sig_cat_test"
        appname: "appname"
        city: "San Jose"
        violation_name: "voilation_name_1"
        ip_address: "10.102.103.113"
        severity: "3"
        violation_action_desc: "Blocked"
        source_ip_address: "174482922"
        attack_time: "1630557173"
        source_ipv6_address: "2001:db8::"
        violation_type_desc: "XSS"
        rpt_sample_time: "1630557173"
        violation_threat_index: "4"
        iprep_category_desc: "iprep_category_1"
        total_attacks: "10000"
        violation_category_desc: "violation_category_1"
        transactionid: "100000"
        transformed_flags: "1000"
        profile_name: "profile_1"

  waf_violation_readwrite:
    type: object
    properties:
      violation_category:
        description: "violation_category."
        type: integer
        format: int32
      app_threat_index:
        description: "violation threat index."
        type: integer
        format: int32
      severity_type:
        description: "severity_type."
        type: integer
        format: int32
      country_code:
        description: "country_code"
        type: string
        format: string
      violation_action:
        description: "action."
        type: integer
        format: int32
      latitude:
        description: "latitude"
        type: number
        format: double
      iprep_score:
        description: "Reputation Score of IP"
        type: integer
        format: int32
      ctnsappname:
        description: "AppName"
        type: string
        format: string
      violation_location:
        description: "violation location."
        type: integer
        format: int32
      http_method:
        description: "HTTP Method."
        type: integer
        format: int32
      violation_value:
        description: "Violation value."
        type: string
        format: string
      not_blocked_flags:
        description: "block_flags."
        type: number
        format: int64
      longitude:
        description: "longitude"
        type: number
        format: double
      region_code:
        description: "region_code"
        type: string
        format: string
      attack_category_desc:
        description: "Attack Category Description"
        type: string
        format: string
      severity_type_desc:
        description: "severity type description"
        type: string
        format: string
      attack_category:
        description: "attack_category"
        type: integer
        format: int32
      http_req_url:
        description: "HTTP Request URL."
        type: string
        format: string
      block_flags:
        description: "block_flags."
        type: number
        format: int64
      counter_value:
        description: "TCP counter values ."
        type: number
        format: int64
      session_id:
        description: "session_id"
        type: string
        format: string
      iprep_category:
        description: "category of IP"
        type: integer
        format: int32
      violation_type:
        description: "violation_type"
        type: integer
        format: int32
      true_client_ip:
        description: "True Client IP Address"
        type: string
        format: string
      violation_location_desc:
        description: "violation location description"
        type: string
        format: string
      signature_category:
        description: "signature_category"
        type: string
        format: string
      appname:
        description: "App Name"
        type: string
        format: string
      city:
        description: "city"
        type: string
        format: string
      violation_name:
        description: "Violation Name."
        type: string
        format: string
      ip_address:
        description: "Field to store the ip address as it is along with any extension"
        type: string
        format: string
      severity:
        description: "severity."
        type: integer
        format: int32
      violation_action_desc:
        description: "violation action description"
        type: string
        format: string
      source_ip_address:
        description: "Server Source IP Address"
        type: number
        format: int64
      attack_time:
        description: "Attack time."
        type: number
        format: int64
      source_ipv6_address:
        description: "Field to store the client ipv6 address"
        type: string
        format: string
      violation_type_desc:
        description: "violation Type Description"
        type: string
        format: string
      rpt_sample_time:
        description: "Report Sample time."
        type: number
        format: int64
      violation_threat_index:
        description: "violation threat index."
        type: integer
        format: int32
      iprep_category_desc:
        description: "Description of category"
        type: string
        format: string
      total_attacks:
        description: "Total attacks to this APP in given sampled timeframe."
        type: number
        format: int64
      violation_category_desc:
        description: "violation_category_desc."
        type: string
        format: string
      transactionid:
        description: "transactionid."
        type: number
        format: int64
      transformed_flags:
        description: "transformed_flags."
        type: number
        format: int64
      profile_name:
        description: "profile_name"
        type: string
        format: string

  waf_violation:
    allOf:
      - $ref: '#/definitions/waf_violation_readwrite'

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