swagger: '2.0'
info:
  description: Configuration for event filter criteria properties resource.
  version: 'v2'
  title: filter_criteria
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: filter_criteria
    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/filter_criteria:
    get:
      tags:
        - filter_criteria
      summary: GET all filter_criteria
      operationId: getall_filter_criteria
      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 filter_criteria 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 filter_criteria 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 filter_criteria resources.
          enum:
            - yes
      responses:
        200:
          description:  for filter_criteria
          schema: 
              $ref: '#/definitions/getfilter_criteriasResponse'
        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:
  getfilter_criteriaResponse:
    type: object
    required:
      - filter_criteria
    properties:
      filter_criteria:
        $ref: '#/definitions/filter_criteria'
    title: getfilter_criteriaResponse
    example:
      filter_criteria:
        source: "1.1.1.1"
        cmd_exec_status: "Success"
        device_family: "ns"
        parent_name: "configchangerule1"
        message: "Disk Usage Normal: nan%"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1346ffb5f"
        cmd_auth_status: "Success"
        config_cmd: "string_value"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        category: "entityDown"
        severity: "Major"
        failureobj: "nsroot"
        category_array: ["string_value1","string_value2"]
        failureobj_array: ["string_value1","string_value2"]
        source_array: ["string_value1","string_value2"]
        severity_array: ["string_value1","string_value2"]

  getfilter_criteriasResponse:
    type: object
    required:
      - filter_criteria
    properties:
      filter_criteria:
        type: array
        items:
          $ref: '#/definitions/filter_criteria'
    title: getfilter_criteriasResponse
    example:
      filter_criteria:
        source: "1.1.1.1"
        cmd_exec_status: "Success"
        device_family: "ns"
        parent_name: "configchangerule1"
        message: "Disk Usage Normal: nan%"
        parent_id: "c970e730-6bc5-44c2-a2bf-8dd1346ffb5f"
        cmd_auth_status: "Success"
        config_cmd: "string_value"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        category: "entityDown"
        severity: "Major"
        failureobj: "nsroot"
        category_array: ["string_value1","string_value2"]
        failureobj_array: ["string_value1","string_value2"]
        source_array: ["string_value1","string_value2"]
        severity_array: ["string_value1","string_value2"]

  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"
