swagger: '2.0'
info:
  description: Configuration for License Threshold configuration resource.
  version: 'v2'
  title: license_threshold
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: license_threshold
    description: License Threshold configuration
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 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/license_threshold:
    get:
      tags:
        - license_threshold
      summary: GET all license_threshold
      operationId: getall_license_threshold
      description: Use this operation to get License notification
      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 license_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 license_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 license_threshold resources.
          enum:
            - yes
      responses:
        200:
          description:  for license_threshold
          schema: 
              $ref: '#/definitions/getlicense_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'

  /massvc/{customerid}/nitro/v2/config/license_threshold/{id}:
    get:
      tags:
        - license_threshold
      summary: GET by key for license_threshold
      operationId: getbykey_license_threshold
      description: Use this operation to get License notification
      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 license_threshold
          schema: 
              $ref: '#/definitions/getlicense_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:
        - license_threshold
      summary: PUT for license_threshold
      operationId: putbykey_license_threshold
      description: Use this operation to modify License notification
      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: license_threshold
          description: license_threshold object
          schema:
              $ref: '#/definitions/modifylicense_thresholdRequest'
      responses:
        200:
          description:  for license_threshold
          schema: 
              $ref: '#/definitions/modifylicense_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'

definitions:
  getlicense_thresholdResponse:
    type: object
    required:
      - license_threshold
    properties:
      license_threshold:
        $ref: '#/definitions/license_threshold'
    title: getlicense_thresholdResponse
    example:
      license_threshold:
        name: "threshold_config"
        rule: "order_by_metrics_value_20 > 10"
        stylebook_flag: "true"
        feature: "Analytics"
        id: "38f867d1-3d10-4bfa-8498-604a57e67bc4"
        pagerduty_profile: "pagerduty_profile"
        servicenow_profile: "pagerduty_profile"
        city: "Santa Clara"
        tenant_name: "Owner"
        region: "LA"
        country: "USA"
        pool_limit: "90"
        sms_profile: "sms_profile_name"
        slack_profile: "slack_profile_name"
        ctnsappname: "app_name"
        resource_type: "app_unit"
        mail_profile: "mail_profile_name"
        is_enabled: "true"
        duration: "l3"
        expiry_threshold: "90"
        ip_address: "1.1.1.1"
        group_name: "WEB"
        reference_key: "attribute"
        exporter_id: "174483313"

  getlicense_thresholdsResponse:
    type: object
    required:
      - license_threshold
    properties:
      license_threshold:
        type: array
        items:
          $ref: '#/definitions/license_threshold'
    title: getlicense_thresholdsResponse
    example:
      license_threshold:
        name: "threshold_config"
        rule: "order_by_metrics_value_20 > 10"
        stylebook_flag: "true"
        feature: "Analytics"
        id: "38f867d1-3d10-4bfa-8498-604a57e67bc4"
        pagerduty_profile: "pagerduty_profile"
        servicenow_profile: "pagerduty_profile"
        city: "Santa Clara"
        tenant_name: "Owner"
        region: "LA"
        country: "USA"
        pool_limit: "90"
        sms_profile: "sms_profile_name"
        slack_profile: "slack_profile_name"
        ctnsappname: "app_name"
        resource_type: "app_unit"
        mail_profile: "mail_profile_name"
        is_enabled: "true"
        duration: "l3"
        expiry_threshold: "90"
        ip_address: "1.1.1.1"
        group_name: "WEB"
        reference_key: "attribute"
        exporter_id: "174483313"

  modifylicense_thresholdRequest:
    type: object
    required:
      - license_threshold
    properties:
      license_threshold:
        $ref: '#/definitions/license_threshold_readwrite'
    title: modifylicense_thresholdRequest
    example:
      license_threshold:
        name: "threshold_config"
        rule: "order_by_metrics_value_20 > 10"
        stylebook_flag: "true"
        feature: "Analytics"
        pagerduty_profile: "pagerduty_profile"
        servicenow_profile: "pagerduty_profile"
        city: "Santa Clara"
        region: "LA"
        country: "USA"
        pool_limit: "90"
        sms_profile: "sms_profile_name"
        slack_profile: "slack_profile_name"
        ctnsappname: "app_name"
        resource_type: "app_unit"
        mail_profile: "mail_profile_name"
        is_enabled: "true"
        duration: "l3"
        expiry_threshold: "90"
        ip_address: "1.1.1.1"
        group_name: "WEB"
        reference_key: "attribute"
        exporter_id: "174483313"

  modifylicense_thresholdResponse:
    type: object
    required:
      - license_threshold
    properties:
      license_threshold:
        $ref: '#/definitions/license_threshold'
    title: modifylicense_thresholdResponse
    example:
      license_threshold:
        name: "threshold_config"
        rule: "order_by_metrics_value_20 > 10"
        stylebook_flag: "true"
        feature: "Analytics"
        id: "38f867d1-3d10-4bfa-8498-604a57e67bc4"
        pagerduty_profile: "pagerduty_profile"
        servicenow_profile: "pagerduty_profile"
        city: "Santa Clara"
        tenant_name: "Owner"
        region: "LA"
        country: "USA"
        pool_limit: "90"
        sms_profile: "sms_profile_name"
        slack_profile: "slack_profile_name"
        ctnsappname: "app_name"
        resource_type: "app_unit"
        mail_profile: "mail_profile_name"
        is_enabled: "true"
        duration: "l3"
        expiry_threshold: "90"
        ip_address: "1.1.1.1"
        group_name: "WEB"
        reference_key: "attribute"
        exporter_id: "174483313"

  license_threshold_readwrite:
    type: object
    properties:
      name:
        description: "name"
        type: string
        format: string
      rule:
        description: "Rule"
        type: string
        format: string
      stylebook_flag:
        description: "Stylebook threshold configuration true or false"
        type: boolean
        format: boolean
      feature:
        description: "feature"
        type: string
        format: string
      pagerduty_profile:
        description: "PagerDuty Profile"
        type: string
        format: string
      servicenow_profile:
        description: "Servicenow Profile"
        type: string
        format: string
      city:
        description: "City"
        type: string
        format: string
        maxLength: 256
      region:
        description: "Region Code"
        type: string
        format: string
        maxLength: 256
      country:
        description: "Country Code"
        type: string
        format: string
        maxLength: 256
      pool_limit:
        description: "Pool limit configuration"
        type: integer
        format: int32
      sms_profile:
        description: "SMS Profile"
        type: string
        format: string
      slack_profile:
        description: "Slack Profile"
        type: string
        format: string
      ctnsappname:
        description: "AppName"
        type: string
        format: string
      resource_type:
        description: "Resource Type"
        type: string
        format: string
      mail_profile:
        description: "Mail Profile"
        type: string
        format: string
      is_enabled:
        description: "true or false"
        type: string
        format: string
      duration:
        description: "duration of metric to be checked against threshold"
        type: string
        format: string
      expiry_threshold:
        description: "Expiry Threshold configuration"
        type: integer
        format: int32
      ip_address:
        description: "Field to store the ip address as it is along with any extension"
        type: string
        format: string
        maxLength: 512
      group_name:
        description: "Group Name"
        type: string
        format: string
      reference_key:
        description: "Reference Key"
        type: string
        format: string
      exporter_id:
        description: "Exporter Id"
        type: number
        format: int64

  license_threshold:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for all the Thresholds configuration 
            type: string
            format: string
          tenant_name:
             description: "Tenant Name"
             type: string
             format: string
      - $ref: '#/definitions/license_threshold_readwrite'

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