swagger: '2.0'
info:
  description: Configuration for HAProxy frontend stats information resource.
  version: 'v2'
  title: haproxy_frontend_stats
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: haproxy_frontend_stats
    description: HAProxy frontend stats information
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/haproxy_frontend_stats:
    get:
      tags:
        - haproxy_frontend_stats
      summary: GET all haproxy_frontend_stats
      operationId: getall_haproxy_frontend_stats
      description: Operation to get HAProxy frontend stats.
      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 haproxy_frontend_stats 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 haproxy_frontend_stats 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 haproxy_frontend_stats resources.
          enum:
            - yes
      responses:
        200:
          description:  for haproxy_frontend_stats
          schema: 
              $ref: '#/definitions/gethaproxy_frontend_statssResponse'
        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/haproxy_frontend_stats/{id}:
    get:
      tags:
        - haproxy_frontend_stats
      summary: GET by key for haproxy_frontend_stats
      operationId: getbykey_haproxy_frontend_stats
      description: Operation to get HAProxy frontend stats.
      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 haproxy_frontend_stats
          schema: 
              $ref: '#/definitions/gethaproxy_frontend_statsResponse'
        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:
  gethaproxy_frontend_statsResponse:
    type: object
    required:
      - haproxy_frontend_stats
    properties:
      haproxy_frontend_stats:
        $ref: '#/definitions/haproxy_frontend_stats'
    title: gethaproxy_frontend_statsResponse
    example:
      haproxy_frontend_stats:
        req_rate: "number_value"
        bin: "number_value"
        hrsp_1xx: "125"
        bout: "1526"
        hrsp_other: "1526"
        ereq: "1526"
        dresp: "1526"
        req_tot: "1526"
        scur: "number_value"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        eresp: "1526"
        hrsp_2xx: "1024"
        dreq: "1526"
        frontend_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        svname: "Service_name"
        hrsp_4xx: "1526"
        hrsp_3xx: "1526"
        stot: "1526"
        hrsp_5xx: "1526"

  gethaproxy_frontend_statssResponse:
    type: object
    required:
      - haproxy_frontend_stats
    properties:
      haproxy_frontend_stats:
        type: array
        items:
          $ref: '#/definitions/haproxy_frontend_stats'
    title: gethaproxy_frontend_statssResponse
    example:
      haproxy_frontend_stats:
        req_rate: "number_value"
        bin: "number_value"
        hrsp_1xx: "125"
        bout: "1526"
        hrsp_other: "1526"
        ereq: "1526"
        dresp: "1526"
        req_tot: "1526"
        scur: "number_value"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        eresp: "1526"
        hrsp_2xx: "1024"
        dreq: "1526"
        frontend_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        svname: "Service_name"
        hrsp_4xx: "1526"
        hrsp_3xx: "1526"
        stot: "1526"
        hrsp_5xx: "1526"

  haproxy_frontend_stats_readwrite:
    type: object
    properties:
      bin:
        description: "Bytes of date in"
        type: number
        format: int64
      hrsp_1xx:
        description: "No of request with response code 1XX"
        type: number
        format: int64
      bout:
        description: "Bytes of data out"
        type: number
        format: int64
      hrsp_other:
        description: "No of request with other response code"
        type: number
        format: int64
      dresp:
        description: "No of response denied"
        type: number
        format: int64
      scur:
        description: "Current Session"
        type: number
        format: int64
      hrsp_2xx:
        description: "No of request with response code 2XX"
        type: number
        format: int64
      dreq:
        description: "No of denied requests"
        type: number
        format: int64
      frontend_id:
        description: "Frontend ID"
        type: string
        format: uuid
        minLength: 1
        maxLength: 64
      svname:
        description: "Service Name"
        type: string
        format: string
        minLength: 1
        maxLength: 100
      hrsp_4xx:
        description: "No of request with response code 4XX"
        type: number
        format: int64
      hrsp_3xx:
        description: "No of request with response code 3XX"
        type: number
        format: int64
      hrsp_5xx:
        description: "No of request with response code 5XX"
        type: number
        format: int64

  haproxy_frontend_stats:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key
            type: string
            format: uuid
          req_rate:
             description: "HTTP Reqrate/Sec"
             type: number
             format: int64
          ereq:
             description: "Number of error requests"
             type: string
             format: string
          req_tot:
             description: "Total number of requests"
             type: string
             format: string
          eresp:
             description: "Number of error responses"
             type: string
             format: string
          stot:
             description: "Total number of sessions"
             type: number
             format: int64
      - $ref: '#/definitions/haproxy_frontend_stats_readwrite'

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