swagger: '2.0'
info:
  description: Configuration for Device Group resource.
  version: 'v2'
  title: device_group
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: device_group
    description: Device Group
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 agent registered with NMX Cloud.
   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/device_group:
    get:
      tags:
        - device_group
      summary: GET all device_group
      operationId: getall_device_group
      description: Use this operation to device group
      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_group 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_group 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_group resources.
          enum:
            - yes
      responses:
        200:
          description:  for device_group
          schema: 
              $ref: '#/definitions/getdevice_groupsResponse'
        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:
        - device_group
      summary: POST operation for device_group
      operationId: post_device_group
      description: POST operation for device_group
      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: device_group
          description: device_group object
          schema:
              $ref: '#/definitions/adddevice_groupRequest'
      responses:
        200:
          description: add for device_group
          schema: 
              $ref: '#/definitions/adddevice_groupResponse'
        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/device_group/{id}:
    get:
      tags:
        - device_group
      summary: GET by key for device_group
      operationId: getbykey_device_group
      description: Use this operation to device group
      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 device_group
          schema: 
              $ref: '#/definitions/getdevice_groupResponse'
        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:
        - device_group
      summary: PUT for device_group
      operationId: putbykey_device_group
      description: Use this operation to modify device_group
      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: device_group
          description: device_group object
          schema:
              $ref: '#/definitions/modifydevice_groupRequest'
      responses:
        200:
          description: add for device_group
          schema: 
              $ref: '#/definitions/modifydevice_groupResponse'
        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:
        - device_group
      summary: Delete for device_group
      operationId: deletebykey_device_group
      description: Use this operation to delete device_group
      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 device_group
        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:
  adddevice_groupRequest:
    type: object
    required:
      - device_group
    properties:
      device_group:
        $ref: '#/definitions/device_group_readwrite'
    title: adddevice_groupRequest
    example:
      device_group:
        static_device_list: "string_value"
        device_family: "ns"
        lock_acquiring_device: "string_value"
        name: "threshold_config"
        duration: "60"
        maintenance_window_start: "string_value"
        criteria_type: "string_value"
        upgrade_version: "NetScaler NS12.1: Build 54.13.nc"
        criteria_condn: "string_value"
        upgrade_lock: "false"
        category: "entityDown"
        disable_upgrade: "false"
        lock_acquire_time: "string_value"
        criteria_value: "string_value"
        static_device_list_arr: ["string_value1","string_value2"]

  adddevice_groupResponse:
    type: object
    required:
      - device_group
    properties:
      device_group:
        $ref: '#/definitions/device_group'
    title: adddevice_groupResponse
    example:
      device_group:
        static_device_list: "string_value"
        device_family: "ns"
        lock_acquiring_device: "string_value"
        name: "threshold_config"
        duration: "60"
        maintenance_window_start: "string_value"
        criteria_type: "string_value"
        upgrade_version: "NetScaler NS12.1: Build 54.13.nc"
        criteria_condn: "string_value"
        upgrade_lock: "false"
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        category: "entityDown"
        disable_upgrade: "false"
        lock_acquire_time: "string_value"
        criteria_value: "string_value"
        static_device_list_arr: ["string_value1","string_value2"]

  getdevice_groupResponse:
    type: object
    required:
      - device_group
    properties:
      device_group:
        $ref: '#/definitions/device_group'
    title: getdevice_groupResponse
    example:
      device_group:
        static_device_list: "string_value"
        device_family: "ns"
        lock_acquiring_device: "string_value"
        name: "threshold_config"
        duration: "60"
        maintenance_window_start: "string_value"
        criteria_type: "string_value"
        upgrade_version: "NetScaler NS12.1: Build 54.13.nc"
        criteria_condn: "string_value"
        upgrade_lock: "false"
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        category: "entityDown"
        disable_upgrade: "false"
        lock_acquire_time: "string_value"
        criteria_value: "string_value"
        static_device_list_arr: ["string_value1","string_value2"]

  getdevice_groupsResponse:
    type: object
    required:
      - device_group
    properties:
      device_group:
        type: array
        items:
          $ref: '#/definitions/device_group'
    title: getdevice_groupsResponse
    example:
      device_group:
        static_device_list: "string_value"
        device_family: "ns"
        lock_acquiring_device: "string_value"
        name: "threshold_config"
        duration: "60"
        maintenance_window_start: "string_value"
        criteria_type: "string_value"
        upgrade_version: "NetScaler NS12.1: Build 54.13.nc"
        criteria_condn: "string_value"
        upgrade_lock: "false"
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        category: "entityDown"
        disable_upgrade: "false"
        lock_acquire_time: "string_value"
        criteria_value: "string_value"
        static_device_list_arr: ["string_value1","string_value2"]

  modifydevice_groupRequest:
    type: object
    required:
      - device_group
    properties:
      device_group:
        $ref: '#/definitions/device_group_readwrite'
    title: modifydevice_groupRequest
    example:
      device_group:
        static_device_list: "string_value"
        device_family: "ns"
        lock_acquiring_device: "string_value"
        name: "threshold_config"
        duration: "60"
        maintenance_window_start: "string_value"
        criteria_type: "string_value"
        upgrade_version: "NetScaler NS12.1: Build 54.13.nc"
        criteria_condn: "string_value"
        upgrade_lock: "false"
        category: "entityDown"
        disable_upgrade: "false"
        lock_acquire_time: "string_value"
        criteria_value: "string_value"
        static_device_list_arr: ["string_value1","string_value2"]

  modifydevice_groupResponse:
    type: object
    required:
      - device_group
    properties:
      device_group:
        $ref: '#/definitions/device_group'
    title: modifydevice_groupResponse
    example:
      device_group:
        static_device_list: "string_value"
        device_family: "ns"
        lock_acquiring_device: "string_value"
        name: "threshold_config"
        duration: "60"
        maintenance_window_start: "string_value"
        criteria_type: "string_value"
        upgrade_version: "NetScaler NS12.1: Build 54.13.nc"
        criteria_condn: "string_value"
        upgrade_lock: "false"
        tenant_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        category: "entityDown"
        disable_upgrade: "false"
        lock_acquire_time: "string_value"
        criteria_value: "string_value"
        static_device_list_arr: ["string_value1","string_value2"]

  device_group_readwrite:
    type: object
    properties:
      static_device_list:
        description: "Devices in the group"
        type: string
        format: string
      device_family:
        description: "Device Family"
        type: string
        format: string
        minLength: 1
        maxLength: 64
      lock_acquiring_device:
        description: "Upgrade Lock acquiring device"
        type: string
        format: string
        maxLength: 255
      name:
        description: "Device Group Name"
        type: string
        format: string
        maxLength: 255
      duration:
        description: "Duration of Maintenance window for groups of category upgrade"
        type: integer
        format: int32
      maintenance_window_start:
        description: "Maintenance window start time for groups of category upgrade"
        type: string
        format: string
        maxLength: 255
      criteria_type:
        description: "Device Group Criteria"
        type: string
        format: string
        maxLength: 255
      upgrade_version:
        description: "New Available upgrade version for devices"
        type: string
        format: string
        maxLength: 255
      criteria_condn:
        description: "Tenant"
        type: string
        format: string
        maxLength: 255
      upgrade_lock:
        description: "Lock to be acquired before upgrading device group"
        type: boolean
        format: boolean
      category:
        description: "Device group category. Will be default/upgrade."
        type: string
        format: string
        maxLength: 255
      disable_upgrade:
        description: "Setting to disable agent upgrades"
        type: boolean
        format: boolean
      lock_acquire_time:
        description: "Upgrade Lock acquiring time"
        type: string
        format: string
        maxLength: 255
      criteria_value:
        description: "Criteria Value"
        type: string
        format: string
        maxLength: 255
      static_device_list_arr:
        description: "Static Device List"
        type: array
        items:
          type: string
          format: string

  device_group:
    allOf:
      -
        properties:
          id:
            description: Id is system generated key for agent registered with NMX Cloud.
            type: string
            format: uuid
          tenant_id:
             description: "Tenant Id"
             type: string
             format: uuid
             maxLength: 255
      - $ref: '#/definitions/device_group_readwrite'

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