swagger: '2.0'
info:
  description: Configuration for AF Transaction Report table resource.
  version: 'v2'
  title: anomaly_details
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: anomaly_details
    description: AF Transaction Report table
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}/nitro/v2/config/anomaly_details:
    get:
      tags:
        - anomaly_details
      summary: GET all anomaly_details
      operationId: getall_anomaly_details
      description: Af Report for Top URL being Count Managed by this AF Collector
      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: ns_vsvrs
          type: string
          required: false
          description: Use this query-parameter to provide the infomation of netscaler and virutal server combination
          enum:
            - ((ns_ip1, vsvrname1)|(ns_ip2, vsvrname2)|(ns_ip3, vsvrname3)
        - in: query
          name: asc
          type: string
          required: false
          description: Use this query-parameter to specify whether the results should be in ascending order or not
          enum:
            - yes
            - no
        - in: query
          name: order_by
          type: string
          required: false
          description: Use this query-parameter to get the result that is ordered by the given property
          enum:
            - total_requests
            - load_time
            - render_time
        - in: query
          name: type
          type: string
          required: false
          description: Use this query-parameter to specify the type
          enum:
            - total_requests
            - load_time
            - render_time
        - in: query
          name: pagesize
          type: integer
          required: false
          description: Use this query-parameter to get the anomaly_details 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 anomaly_details 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 anomaly_details resources.
          enum:
            - yes
      responses:
        200:
          description:  for anomaly_details
          schema: 
              $ref: '#/definitions/getanomaly_detailssResponse'
        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:
  getanomaly_detailsResponse:
    type: object
    required:
      - anomaly_details
    properties:
      anomaly_details:
        $ref: '#/definitions/anomaly_details'
    title: getanomaly_detailsResponse
    example:
      anomaly_details:
        hits_rate: "0"
        __count: "0"
        serv_tot_hits: "0"
        metric_key: "HIT_KEY"
        state: "up"
        max_avg_ttfb: "1580364711"
        max_hits: "3"
        metric_name: "HIT"
        svcname: "test_app"
        ctnsappname: "test_app"
        ip_address: "1.1.1.1"
        server_ip_address: "1.1.1.1"
        reason: "GET"
        rpt_sample_time: "1580364711"
        usecase: "service_hit"
        avg_ttfb: "1580364711"
        hits_total: "5"

  getanomaly_detailssResponse:
    type: object
    required:
      - anomaly_details
    properties:
      anomaly_details:
        type: array
        items:
          $ref: '#/definitions/anomaly_details'
    title: getanomaly_detailssResponse
    example:
      anomaly_details:
        hits_rate: "0"
        __count: "0"
        serv_tot_hits: "0"
        metric_key: "HIT_KEY"
        state: "up"
        max_avg_ttfb: "1580364711"
        max_hits: "3"
        metric_name: "HIT"
        svcname: "test_app"
        ctnsappname: "test_app"
        ip_address: "1.1.1.1"
        server_ip_address: "1.1.1.1"
        reason: "GET"
        rpt_sample_time: "1580364711"
        usecase: "service_hit"
        avg_ttfb: "1580364711"
        hits_total: "5"

  anomaly_details_readwrite:
    type: object
    properties:
      hits_rate:
        description: "Hits Rate"
        type: number
        format: double
      __count:
        description: "count."
        type: number
        format: double
      serv_tot_hits:
        description: "Last Transaction Time for this URL in the sampled timeframe."
        type: number
        format: int64
      state:
        description: "State up/down"
        type: string
        format: string
        minLength: 1
        maxLength: 64
      max_avg_ttfb:
        description: " max_avg_ttfb time."
        type: number
        format: double
      max_hits:
        description: "Count of this URL in given sampled timeframe."
        type: number
        format: int64
      metric_name:
        description: "HTTP Request Method."
        type: string
        format: string
        maxLength: 30
      svcname:
        description: "AppName"
        type: string
        format: string
        maxLength: 255
      ctnsappname:
        description: "AppName"
        type: string
        format: string
        maxLength: 255
      ip_address:
        description: "IP Address"
        type: string
        format: ipaddress
        maxLength: 512
      server_ip_address:
        description: "Server Source IP Address"
        type: string
        format: ipaddress
        minLength: 1
        maxLength: 64
      reason:
        description: "HTTP Request URL."
        type: string
        format: string
        maxLength: 100
      rpt_sample_time:
        description: "Report Sample time."
        type: number
        format: int64
      usecase:
        description: "Use Case."
        type: string
        format: string
        maxLength: 100
      avg_ttfb:
        description: "Render time."
        type: number
        format: double
      hits_total:
        description: "Total bytes accounted by this URL in sampled timeframe."
        type: number
        format: int64

  anomaly_details:
    allOf:
      - $ref: '#/definitions/anomaly_details_readwrite'

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