swagger: '2.0'
info:
  description: Configuration for event filter criteria properties resource.
  version: 'v2'
  title: event_filter
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: event_filter
    description: event filter criteria properties
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/event_filter:
    get:
      tags:
        - event_filter
      summary: GET all event_filter
      operationId: getall_event_filter
      description: Use this operation to get filters
      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 event_filter 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 event_filter 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 event_filter resources.
          enum:
            - yes
      responses:
        200:
          description:  for event_filter
          schema: 
              $ref: '#/definitions/getevent_filtersResponse'
        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:
        - event_filter
      summary: POST operation for event_filter
      operationId: post_event_filter
      description: POST operation for event_filter
      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: event_filter
          description: event_filter object
          schema:
              $ref: '#/definitions/addevent_filterRequest'
      responses:
        200:
          description: add for event_filter
          schema: 
              $ref: '#/definitions/addevent_filterResponse'
        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/event_filter/{id}:
    get:
      tags:
        - event_filter
      summary: GET by key for event_filter
      operationId: getbykey_event_filter
      description: Use this operation to get filters
      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 event_filter
          schema: 
              $ref: '#/definitions/getevent_filterResponse'
        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:
        - event_filter
      summary: PUT for event_filter
      operationId: putbykey_event_filter
      description: modify event filter
      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: event_filter
          description: event_filter object
          schema:
              $ref: '#/definitions/modifyevent_filterRequest'
      responses:
        200:
          description: add for event_filter
          schema: 
              $ref: '#/definitions/modifyevent_filterResponse'
        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:
        - event_filter
      summary: Delete for event_filter
      operationId: deletebykey_event_filter
      description: Use this operation to delete event filters
      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 event_filter
        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:
  addevent_filterRequest:
    type: object
    required:
      - event_filter
    properties:
      event_filter:
        $ref: '#/definitions/event_filter_readwrite'
    title: addevent_filterRequest
    example:
      event_filter:
        is_enabled: "boolean_value"
        actions: [{        parent_name: "string_value"
,        type: "string_value"
,        id: "string_value"
,        suppress_time: "integer_value"
,        parent_id: "string_value"
,        repeat_email_notification_threshold: "integer_value"
,        attachment: "string_value"
,        subject: "string_value"
,        user_message: "string_value"
,        profile_name: "string_value"
}]
        event_age_threshold: "0"
        name: "configChangeRule"
        enable_advanced_regex: "false"
        criteria: {        source: "string_value"
,        cmd_exec_status: "string_value"
,        device_family: "string_value"
,        parent_name: "string_value"
,        message: "string_value"
,        parent_id: "string_value"
,        cmd_auth_status: "string_value"
,        config_cmd: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        failureobj: "string_value"
,        category_array: ["string_value1","string_value2"]
,        failureobj_array: ["string_value1","string_value2"]
,        source_array: ["string_value1","string_value2"]
,        severity_array: ["string_value1","string_value2"]
}
        display_event: "false"

  addevent_filterResponse:
    type: object
    required:
      - event_filter
    properties:
      event_filter:
        $ref: '#/definitions/event_filter'
    title: addevent_filterResponse
    example:
      event_filter:
        is_enabled: "boolean_value"
        actions: [{        parent_name: "string_value"
,        props: [{}]
,        action_name: "string_value"
,        type: "string_value"
,        id: "string_value"
,        suppress_time: "integer_value"
,        parent_id: "string_value"
,        repeat_email_notification_threshold: "integer_value"
,        attachment: "string_value"
,        subject: "string_value"
,        sender: "string_value"
,        subject_attach_failureobject: "boolean_value"
,        user_message: "string_value"
,        profile_name: "string_value"
}]
        event_age_threshold: "0"
        name: "configChangeRule"
        enable_advanced_regex: "false"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        criteria: {        source: "string_value"
,        cmd_exec_status: "string_value"
,        device_family: "string_value"
,        parent_name: "string_value"
,        message: "string_value"
,        parent_id: "string_value"
,        cmd_auth_status: "string_value"
,        config_cmd: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        failureobj: "string_value"
,        category_array: ["string_value1","string_value2"]
,        failureobj_array: ["string_value1","string_value2"]
,        source_array: ["string_value1","string_value2"]
,        severity_array: ["string_value1","string_value2"]
}
        display_event: "false"
        is_suppress_enabled: "boolean_value"

  getevent_filterResponse:
    type: object
    required:
      - event_filter
    properties:
      event_filter:
        $ref: '#/definitions/event_filter'
    title: getevent_filterResponse
    example:
      event_filter:
        is_enabled: "boolean_value"
        actions: [{        parent_name: "string_value"
,        props: [{}]
,        action_name: "string_value"
,        type: "string_value"
,        id: "string_value"
,        suppress_time: "integer_value"
,        parent_id: "string_value"
,        repeat_email_notification_threshold: "integer_value"
,        attachment: "string_value"
,        subject: "string_value"
,        sender: "string_value"
,        subject_attach_failureobject: "boolean_value"
,        user_message: "string_value"
,        profile_name: "string_value"
}]
        event_age_threshold: "0"
        name: "configChangeRule"
        enable_advanced_regex: "false"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        criteria: {        source: "string_value"
,        cmd_exec_status: "string_value"
,        device_family: "string_value"
,        parent_name: "string_value"
,        message: "string_value"
,        parent_id: "string_value"
,        cmd_auth_status: "string_value"
,        config_cmd: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        failureobj: "string_value"
,        category_array: ["string_value1","string_value2"]
,        failureobj_array: ["string_value1","string_value2"]
,        source_array: ["string_value1","string_value2"]
,        severity_array: ["string_value1","string_value2"]
}
        display_event: "false"
        is_suppress_enabled: "boolean_value"

  getevent_filtersResponse:
    type: object
    required:
      - event_filter
    properties:
      event_filter:
        type: array
        items:
          $ref: '#/definitions/event_filter'
    title: getevent_filtersResponse
    example:
      event_filter:
        is_enabled: "boolean_value"
        actions: [{        parent_name: "string_value"
,        props: [{}]
,        action_name: "string_value"
,        type: "string_value"
,        id: "string_value"
,        suppress_time: "integer_value"
,        parent_id: "string_value"
,        repeat_email_notification_threshold: "integer_value"
,        attachment: "string_value"
,        subject: "string_value"
,        sender: "string_value"
,        subject_attach_failureobject: "boolean_value"
,        user_message: "string_value"
,        profile_name: "string_value"
}]
        event_age_threshold: "0"
        name: "configChangeRule"
        enable_advanced_regex: "false"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        criteria: {        source: "string_value"
,        cmd_exec_status: "string_value"
,        device_family: "string_value"
,        parent_name: "string_value"
,        message: "string_value"
,        parent_id: "string_value"
,        cmd_auth_status: "string_value"
,        config_cmd: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        failureobj: "string_value"
,        category_array: ["string_value1","string_value2"]
,        failureobj_array: ["string_value1","string_value2"]
,        source_array: ["string_value1","string_value2"]
,        severity_array: ["string_value1","string_value2"]
}
        display_event: "false"
        is_suppress_enabled: "boolean_value"

  modifyevent_filterRequest:
    type: object
    required:
      - event_filter
    properties:
      event_filter:
        $ref: '#/definitions/event_filter_readwrite'
    title: modifyevent_filterRequest
    example:
      event_filter:
        is_enabled: "boolean_value"
        actions: [{        parent_name: "string_value"
,        type: "string_value"
,        id: "string_value"
,        suppress_time: "integer_value"
,        parent_id: "string_value"
,        repeat_email_notification_threshold: "integer_value"
,        attachment: "string_value"
,        subject: "string_value"
,        user_message: "string_value"
,        profile_name: "string_value"
}]
        event_age_threshold: "0"
        name: "configChangeRule"
        enable_advanced_regex: "false"
        criteria: {        source: "string_value"
,        cmd_exec_status: "string_value"
,        device_family: "string_value"
,        parent_name: "string_value"
,        message: "string_value"
,        parent_id: "string_value"
,        cmd_auth_status: "string_value"
,        config_cmd: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        failureobj: "string_value"
,        category_array: ["string_value1","string_value2"]
,        failureobj_array: ["string_value1","string_value2"]
,        source_array: ["string_value1","string_value2"]
,        severity_array: ["string_value1","string_value2"]
}
        display_event: "false"

  modifyevent_filterResponse:
    type: object
    required:
      - event_filter
    properties:
      event_filter:
        $ref: '#/definitions/event_filter'
    title: modifyevent_filterResponse
    example:
      event_filter:
        is_enabled: "boolean_value"
        actions: [{        parent_name: "string_value"
,        props: [{}]
,        action_name: "string_value"
,        type: "string_value"
,        id: "string_value"
,        suppress_time: "integer_value"
,        parent_id: "string_value"
,        repeat_email_notification_threshold: "integer_value"
,        attachment: "string_value"
,        subject: "string_value"
,        sender: "string_value"
,        subject_attach_failureobject: "boolean_value"
,        user_message: "string_value"
,        profile_name: "string_value"
}]
        event_age_threshold: "0"
        name: "configChangeRule"
        enable_advanced_regex: "false"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        criteria: {        source: "string_value"
,        cmd_exec_status: "string_value"
,        device_family: "string_value"
,        parent_name: "string_value"
,        message: "string_value"
,        parent_id: "string_value"
,        cmd_auth_status: "string_value"
,        config_cmd: "string_value"
,        id: "string_value"
,        category: "string_value"
,        severity: "string_value"
,        failureobj: "string_value"
,        category_array: ["string_value1","string_value2"]
,        failureobj_array: ["string_value1","string_value2"]
,        source_array: ["string_value1","string_value2"]
,        severity_array: ["string_value1","string_value2"]
}
        display_event: "false"
        is_suppress_enabled: "boolean_value"

  event_filter_readwrite:
    type: object
    properties:
      is_enabled:
        description: "enabled or disabled"
        type: boolean
        format: boolean
      actions:
        type: array
        items:
          $ref: '#/definitions/filter_action_readwrite'
      event_age_threshold:
        description: "Event Age Threshold - Specify the time interval for which the event has to be in the same state to trigger the action"
        type: integer
        format: int32
      name:
        description: "Filter Name"
        type: string
        format: string
        maxLength: 255
      enable_advanced_regex:
        description: "Enable Advanced regex for Failure Objects, Message and configuration command"
        type: boolean
        format: boolean
      criteria:
        $ref: '#/definitions/filter_criteria_readwrite'
      display_event:
        description: "Display the event even when event age threshold is set."
        type: boolean
        format: boolean

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

  filter_action_readwrite:
    type: object
    properties:
      parent_name:
        description: "Name of the parent resource"
        type: string
        format: string
      type:
        description: "Action Type e.g. SENDMAIL,SENDSMS"
        type: string
        format: string
        maxLength: 255
      suppress_time:
        description: "If specified, the particular event will be suppressed for this time"
        type: integer
        format: int32
      parent_id:
        description: "Id of the parent resource"
        type: string
        format: uuid
      repeat_email_notification_threshold:
        description: "RepeatEmailNotificationThreshold - If enabled, send the mail repeatedly at the specified intervals untill the event is cleared"
        type: integer
        format: int32
      attachment:
        description: "Attachment for the E-mail action"
        type: string
        format: string
      subject:
        description: "Subject of the mail"
        type: string
        format: string
        maxLength: 255
      user_message:
        description: "User Message"
        type: string
        format: string
      profile_name:
        description: "Mail or SMS profile name"
        type: string
        format: string

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

  filter_criteria_readwrite:
    type: object
    properties:
      source:
        description: "Source Ip Address of the device which sent the trap"
        type: string
        format: ipaddress
      cmd_exec_status:
        description: "Command Execution Status if the event is generated for any config change or config save in device"
        type: string
        format: string
      device_family:
        description: "Family of device for which we have received the event"
        type: string
        format: string
      parent_name:
        description: "Name of the parent resource"
        type: string
        format: string
      message:
        description: "Event Message"
        type: string
        format: string
      parent_id:
        description: "Id of the parent resource"
        type: string
        format: uuid
      cmd_auth_status:
        description: "Command Authorization Status if the event is generated for any config change or config save in device"
        type: string
        format: string
      config_cmd:
        description: "Config Command if the event is generated for any config change in device"
        type: string
        format: string
      category:
        description: "Category of Event"
        type: string
        format: string
        maxLength: 10000
      severity:
        description: "Severity of Event"
        type: string
        format: string
      failureobj:
        description: "Failure objects are entity instances or counters for which an event has been generated"
        type: string
        format: string
      category_array:
        description: "Category list"
        type: array
        items:
          type: string
          format: string
      failureobj_array:
        description: "Failure Object list"
        type: array
        items:
          type: string
          format: string
      source_array:
        description: "Source list"
        type: array
        items:
          type: string
          format: string
      severity_array:
        description: "Severity list"
        type: array
        items:
          type: string
          format: string

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

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