swagger: '2.0'
info:
  description: Configuration for monitoring file list diff present in nsconfig folder of NetScaler instances resource.
  version: 'v2'
  title: ns_filediff
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_filediff
    description: monitoring file list diff present in nsconfig folder of NetScaler instances
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/ns_filediff:
    get:
      tags:
        - ns_filediff
      summary: GET all ns_filediff
      operationId: getall_ns_filediff
      description: Use this operation to get file list present in nsconfig folder of ADC
      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 ns_filediff 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 ns_filediff 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 ns_filediff resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_filediff
          schema: 
              $ref: '#/definitions/getns_filediffsResponse'
        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/ns_filediff/{id}:
    get:
      tags:
        - ns_filediff
      summary: GET by key for ns_filediff
      operationId: getbykey_ns_filediff
      description: Use this operation to get file list present in nsconfig folder of ADC
      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 ns_filediff
          schema: 
              $ref: '#/definitions/getns_filediffResponse'
        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:
  getns_filediffResponse:
    type: object
    required:
      - ns_filediff
    properties:
      ns_filediff:
        $ref: '#/definitions/ns_filediff'
    title: getns_filediffResponse
    example:
      ns_filediff:
        latest_polled_timestamp: "1580378055"
        previous_filelist_details: "ZebOS.conf,ZebOS.conf.0"
        diff_summary: "ns.conf.0 modified"
        display_name: "1.1.1.1-1.1.1.2"
        latest_filelist_details: "ZebOS.conf,ZebOS.conf.0"
        previous_polled_timestamp: "1580364712"
        host_name: "ADC12-lab45"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        ip_address: "1.1.1.1"
        diff_exists: "No Diff"
        filediff_na_count: "7"
        file_name: "ns.conf.0"
        last_modified: "1580323680"
        filediff_count: "11"
        diff_status: "modified"
        total_count: "51"

  getns_filediffsResponse:
    type: object
    required:
      - ns_filediff
    properties:
      ns_filediff:
        type: array
        items:
          $ref: '#/definitions/ns_filediff'
    title: getns_filediffsResponse
    example:
      ns_filediff:
        latest_polled_timestamp: "1580378055"
        previous_filelist_details: "ZebOS.conf,ZebOS.conf.0"
        diff_summary: "ns.conf.0 modified"
        display_name: "1.1.1.1-1.1.1.2"
        latest_filelist_details: "ZebOS.conf,ZebOS.conf.0"
        previous_polled_timestamp: "1580364712"
        host_name: "ADC12-lab45"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        ip_address: "1.1.1.1"
        diff_exists: "No Diff"
        filediff_na_count: "7"
        file_name: "ns.conf.0"
        last_modified: "1580323680"
        filediff_count: "11"
        diff_status: "modified"
        total_count: "51"

  ns_filediff_readwrite:
    type: object
    properties:
      previous_filelist_details:
        description: "Comma separated list of files under nsconfig folder found in previous poll"
        type: string
        format: string
      diff_summary:
        description: "diff summary"
        type: string
        format: string
      display_name:
        description: "display name "
        type: string
        format: string
      latest_filelist_details:
        description: "Comma separated list of files under nsconfig folder found in latest poll"
        type: string
        format: string
      host_name:
        description: "host name"
        type: string
        format: string
      diff_exists:
        description: "Diff exists. Possible values No Diff,NA,Diff Exists"
        type: string
        format: string
      filediff_na_count:
        description: "Total file diff not applicable count "
        type: integer
        format: int32
      file_name:
        description: "file name"
        type: string
        format: string
      last_modified:
        description: "last modified timestamp of the file"
        type: number
        format: int64
      filediff_count:
        description: "Total file diff count "
        type: integer
        format: int32
      diff_status:
        description: "diff status of the file. Possible values: added,modified,deleted"
        type: string
        format: string
      total_count:
        description: "Total count available "
        type: integer
        format: int32

  ns_filediff:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key
            type: string
            format: uuid
          latest_polled_timestamp:
             description: "Latest polled timestamp"
             type: number
             format: int64
          previous_polled_timestamp:
             description: "Previous polled timestamp"
             type: number
             format: int64
          ip_address:
             description: "IP Address of NetScaler device"
             type: string
             format: ipaddress
             minLength: 1
             maxLength: 64
      - $ref: '#/definitions/ns_filediff_readwrite'

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