swagger: '2.0'
info:
  description: Configuration for Device License Info resource.
  version: 'v2'
  title: device_license_info
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: device_license_info
    description: Device License Info
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/device_license_info:
    get:
      tags:
        - device_license_info
      summary: GET all device_license_info
      operationId: getall_device_license_info
      description: Use this operation to get device license info
      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 device_license_info 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 device_license_info 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 device_license_info resources.
          enum:
            - yes
      responses:
        200:
          description:  for device_license_info
          schema: 
              $ref: '#/definitions/getdevice_license_infosResponse'
        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:
  getdevice_license_infoResponse:
    type: object
    required:
      - device_license_info
    properties:
      device_license_info:
        $ref: '#/definitions/device_license_info'
    title: getdevice_license_infoResponse
    example:
      device_license_info:
        allocated_standard_bw: "0"
        configured_on_vm: "0"
        current_throughput: "string_value"
        allocated_on_vm: "0"
        license_state: "Down"
        last_updated_time: "number_value"
        allocated_advanced_bw: "0"
        ip_address: "1.1.1.1"
        flexed_instance_type: "string_value"
        license_pool: "string_value"
        name: "test_template"
        managed_device_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        grace: "false"
        details: "string_value"
        instance_mode: "string_value"
        allocated_premium_bw: "0"
        allocated: "0"
        allocated_instance: "0"
        hours_to_expiry: "0"
        type: "NS"

  getdevice_license_infosResponse:
    type: object
    required:
      - device_license_info
    properties:
      device_license_info:
        type: array
        items:
          $ref: '#/definitions/device_license_info'
    title: getdevice_license_infosResponse
    example:
      device_license_info:
        allocated_standard_bw: "0"
        configured_on_vm: "0"
        current_throughput: "string_value"
        allocated_on_vm: "0"
        license_state: "Down"
        last_updated_time: "number_value"
        allocated_advanced_bw: "0"
        ip_address: "1.1.1.1"
        flexed_instance_type: "string_value"
        license_pool: "string_value"
        name: "test_template"
        managed_device_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        grace: "false"
        details: "string_value"
        instance_mode: "string_value"
        allocated_premium_bw: "0"
        allocated: "0"
        allocated_instance: "0"
        hours_to_expiry: "0"
        type: "NS"

  device_license_info_readwrite:
    type: object
    properties:
      last_updated_time:
        description: "Last Updated Time"
        type: number
        format: int64
      flexed_instance_type:
        description: "Flexed instance type and count, like Multi Tenant:1,Single Tenant:6,Bare Metal:1,CPX:1"
        type: string
        format: string
      details:
        description: "Details about license  state"
        type: string
        format: string
      instance_mode:
        description: "instance mode of device"
        type: string
        format: string

  device_license_info:
    allOf:
      -
        properties:
          allocated_standard_bw:
             description: "Running standard license capacity of VM"
             type: integer
             format: int32
          configured_on_vm:
             description: "Configured license capacity of VM"
             type: integer
             format: int32
          current_throughput:
             description: "Current Througput of device"
             type: string
             format: string
          allocated_on_vm:
             description: "Running license capacity of VM"
             type: integer
             format: int32
          license_state:
             description: "State of device, UP only if device accessible"
             type: string
             format: string
             minLength: 1
             maxLength: 64
          allocated_advanced_bw:
             description: "Running advanced license capacity of VM"
             type: integer
             format: int32
          ip_address:
             description: "IP Address for this managed device"
             type: string
             format: ipaddress
             minLength: 1
             maxLength: 64
          license_pool:
             description: "License Pool"
             type: string
             format: string
             minLength: 1
             maxLength: 64
          name:
             description: "Name of managed device"
             type: string
             format: string
             minLength: 1
             maxLength: 128
          managed_device_id:
             description: "Device id managaed device"
             type: string
             format: uuid
          grace:
             description: "True if this device is managed by NMX"
             type: boolean
             format: boolean
          allocated_premium_bw:
             description: "Running premium license capacity of VM"
             type: integer
             format: int32
          allocated:
             description: "Allocate license on License server"
             type: integer
             format: int32
          allocated_instance:
             description: "Running instance license capacity of VM"
             type: integer
             format: int32
          hours_to_expiry:
             description: "No of Hours after which grace license expires"
             type: integer
             format: int32
          type:
             description: "Type of device, (Xen | NS)"
             type: string
             format: string
             minLength: 1
             maxLength: 64
      - $ref: '#/definitions/device_license_info_readwrite'

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