swagger: '2.0'
info:
  description: Configuration for PerfThreshold resource.
  version: 'v2'
  title: perf_threshold
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: perf_threshold
    description: PerfThreshold
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 for all the perf thresholds configuration 
   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/perf_threshold:
    get:
      tags:
        - perf_threshold
      summary: GET all perf_threshold
      operationId: getall_perf_threshold
      description: get perf threshold configuration
      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 perf_threshold 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 perf_threshold 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 perf_threshold resources.
          enum:
            - yes
      responses:
        200:
          description:  for perf_threshold
          schema: 
              $ref: '#/definitions/getperf_thresholdsResponse'
        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:
        - perf_threshold
      summary: POST operation for perf_threshold
      operationId: post_perf_threshold
      description: POST operation for perf_threshold
      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: perf_threshold
          description: perf_threshold object
          schema:
              $ref: '#/definitions/addperf_thresholdRequest'
      responses:
        200:
          description: add for perf_threshold
          schema: 
              $ref: '#/definitions/addperf_thresholdResponse'
        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/perf_threshold/{id}:
    get:
      tags:
        - perf_threshold
      summary: GET by key for perf_threshold
      operationId: getbykey_perf_threshold
      description: get perf threshold configuration
      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 perf_threshold
          schema: 
              $ref: '#/definitions/getperf_thresholdResponse'
        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:
        - perf_threshold
      summary: PUT for perf_threshold
      operationId: putbykey_perf_threshold
      description: modify perf threshold configuration
      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: perf_threshold
          description: perf_threshold object
          schema:
              $ref: '#/definitions/modifyperf_thresholdRequest'
      responses:
        200:
          description: add for perf_threshold
          schema: 
              $ref: '#/definitions/modifyperf_thresholdResponse'
        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:
        - perf_threshold
      summary: Delete for perf_threshold
      operationId: deletebykey_perf_threshold
      description: Delete perf threshold configuration
      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 perf_threshold
        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:
  addperf_thresholdRequest:
    type: object
    required:
      - perf_threshold
    properties:
      perf_threshold:
        $ref: '#/definitions/perf_threshold_readwrite'
    title: addperf_thresholdRequest
    example:
      perf_threshold:
        sms_profile: "test_sms_profile"
        clear_message: "Normal value reached"
        slack_profile: "test_slack_profile"
        threshold_type: "max"
        entity_type: "global"
        report_name: "perf_res_util_report"
        severity: "Critical"
        mail_profile: "test_mail_profile"
        is_enabled: "t"
        pagerduty_profile: "test_pager_profile"
        device_family: "ns"
        threshold_value: "80.0"
        name: "Threshold_Test"
        counter_name: "memusagepcnt"
        message: "Test threshold"
        clear_value: "40.0"
        servicenow_profile: "test_svcnow_profile"
        entities_array: ["string_value1","string_value2"]
        devices_array: ["string_value1","string_value2"]

  addperf_thresholdResponse:
    type: object
    required:
      - perf_threshold
    properties:
      perf_threshold:
        $ref: '#/definitions/perf_threshold'
    title: addperf_thresholdResponse
    example:
      perf_threshold:
        sms_profile: "test_sms_profile"
        clear_message: "Normal value reached"
        slack_profile: "test_slack_profile"
        entities: "lb1@1.1.1.1,lb2@1.1.1.2"
        threshold_type: "max"
        clear_event: "f"
        entity_type: "global"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        report_name: "perf_res_util_report"
        severity: "Critical"
        mail_profile: "test_mail_profile"
        tenant_name: "admproduction"
        is_enabled: "t"
        pagerduty_profile: "test_pager_profile"
        device_family: "ns"
        threshold_value: "80.0"
        name: "Threshold_Test"
        duration: "weekly"
        counter_name: "memusagepcnt"
        devices: "1.1.1.1"
        message: "Test threshold"
        clear_value: "40.0"
        servicenow_profile: "test_svcnow_profile"
        entities_array: ["string_value1","string_value2"]
        devices_array: ["string_value1","string_value2"]

  getperf_thresholdResponse:
    type: object
    required:
      - perf_threshold
    properties:
      perf_threshold:
        $ref: '#/definitions/perf_threshold'
    title: getperf_thresholdResponse
    example:
      perf_threshold:
        sms_profile: "test_sms_profile"
        clear_message: "Normal value reached"
        slack_profile: "test_slack_profile"
        entities: "lb1@1.1.1.1,lb2@1.1.1.2"
        threshold_type: "max"
        clear_event: "f"
        entity_type: "global"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        report_name: "perf_res_util_report"
        severity: "Critical"
        mail_profile: "test_mail_profile"
        tenant_name: "admproduction"
        is_enabled: "t"
        pagerduty_profile: "test_pager_profile"
        device_family: "ns"
        threshold_value: "80.0"
        name: "Threshold_Test"
        duration: "weekly"
        counter_name: "memusagepcnt"
        devices: "1.1.1.1"
        message: "Test threshold"
        clear_value: "40.0"
        servicenow_profile: "test_svcnow_profile"
        entities_array: ["string_value1","string_value2"]
        devices_array: ["string_value1","string_value2"]

  getperf_thresholdsResponse:
    type: object
    required:
      - perf_threshold
    properties:
      perf_threshold:
        type: array
        items:
          $ref: '#/definitions/perf_threshold'
    title: getperf_thresholdsResponse
    example:
      perf_threshold:
        sms_profile: "test_sms_profile"
        clear_message: "Normal value reached"
        slack_profile: "test_slack_profile"
        entities: "lb1@1.1.1.1,lb2@1.1.1.2"
        threshold_type: "max"
        clear_event: "f"
        entity_type: "global"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        report_name: "perf_res_util_report"
        severity: "Critical"
        mail_profile: "test_mail_profile"
        tenant_name: "admproduction"
        is_enabled: "t"
        pagerduty_profile: "test_pager_profile"
        device_family: "ns"
        threshold_value: "80.0"
        name: "Threshold_Test"
        duration: "weekly"
        counter_name: "memusagepcnt"
        devices: "1.1.1.1"
        message: "Test threshold"
        clear_value: "40.0"
        servicenow_profile: "test_svcnow_profile"
        entities_array: ["string_value1","string_value2"]
        devices_array: ["string_value1","string_value2"]

  modifyperf_thresholdRequest:
    type: object
    required:
      - perf_threshold
    properties:
      perf_threshold:
        $ref: '#/definitions/perf_threshold_readwrite'
    title: modifyperf_thresholdRequest
    example:
      perf_threshold:
        sms_profile: "test_sms_profile"
        clear_message: "Normal value reached"
        slack_profile: "test_slack_profile"
        threshold_type: "max"
        entity_type: "global"
        report_name: "perf_res_util_report"
        severity: "Critical"
        mail_profile: "test_mail_profile"
        is_enabled: "t"
        pagerduty_profile: "test_pager_profile"
        device_family: "ns"
        threshold_value: "80.0"
        name: "Threshold_Test"
        counter_name: "memusagepcnt"
        message: "Test threshold"
        clear_value: "40.0"
        servicenow_profile: "test_svcnow_profile"
        entities_array: ["string_value1","string_value2"]
        devices_array: ["string_value1","string_value2"]

  modifyperf_thresholdResponse:
    type: object
    required:
      - perf_threshold
    properties:
      perf_threshold:
        $ref: '#/definitions/perf_threshold'
    title: modifyperf_thresholdResponse
    example:
      perf_threshold:
        sms_profile: "test_sms_profile"
        clear_message: "Normal value reached"
        slack_profile: "test_slack_profile"
        entities: "lb1@1.1.1.1,lb2@1.1.1.2"
        threshold_type: "max"
        clear_event: "f"
        entity_type: "global"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        report_name: "perf_res_util_report"
        severity: "Critical"
        mail_profile: "test_mail_profile"
        tenant_name: "admproduction"
        is_enabled: "t"
        pagerduty_profile: "test_pager_profile"
        device_family: "ns"
        threshold_value: "80.0"
        name: "Threshold_Test"
        duration: "weekly"
        counter_name: "memusagepcnt"
        devices: "1.1.1.1"
        message: "Test threshold"
        clear_value: "40.0"
        servicenow_profile: "test_svcnow_profile"
        entities_array: ["string_value1","string_value2"]
        devices_array: ["string_value1","string_value2"]

  perf_threshold_readwrite:
    type: object
    properties:
      sms_profile:
        description: "SMS Profile"
        type: string
        format: string
      clear_message:
        description: "Clear Message"
        type: string
        format: string
      slack_profile:
        description: "Slack Profile"
        type: string
        format: string
      threshold_type:
        description: "Threshold Type"
        type: string
        format: string
      entity_type:
        description: "Entity Type"
        type: string
        format: string
      report_name:
        description: "Report Name for which the threshold is configured"
        type: string
        format: string
        minLength: 1
        maxLength: 100
      severity:
        description: "Severity"
        type: string
        format: string
      mail_profile:
        description: "Mail Profile"
        type: string
        format: string
      is_enabled:
        description: "enabled or disabled"
        type: boolean
        format: boolean
      pagerduty_profile:
        description: "PagerDuty Profile"
        type: string
        format: string
      device_family:
        description: "Device Family of which this threshold belongs to"
        type: string
        format: string
      threshold_value:
        description: "Threshold Value"
        type: number
        format: double
      name:
        description: "name"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      counter_name:
        description: "Counter Name for which the threshold is configured"
        type: string
        format: string
        minLength: 1
        maxLength: 100
      message:
        description: "Message"
        type: string
        format: string
      clear_value:
        description: "Clear Value"
        type: number
        format: double
      servicenow_profile:
        description: "ServiceNow Profile"
        type: string
        format: string
      entities_array:
        description: "Instances list"
        type: array
        items:
          type: string
          format: string
      devices_array:
        description: "Devices list"
        type: array
        items:
          type: string
          format: string

  perf_threshold:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the perf thresholds configuration 
            type: string
            format: uuid
          entities:
             description: "Entitles like vserver, service or servicegroup with instance display names"
             type: string
             format: string
             maxLength: 4096
          devices:
             description: "Display Names of NetScaler instances"
             type: string
             format: string
             maxLength: 4096
      - $ref: '#/definitions/perf_threshold_readwrite'

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