swagger: '2.0'
info:
  description: Configuration for Device generic utility resource.
  version: 'v2'
  title: device_generic_resrc
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: device_generic_resrc
    description: Device generic utility
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_generic_resrc:
    post:
      tags:
        - device_generic_resrc
      summary: POST operation for device_generic_resrc
      operationId: post_device_generic_resrc
      description: POST operation for device_generic_resrc
      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_generic_resrc
          description: device_generic_resrc object
          schema:
              $ref: '#/definitions/adddevice_generic_resrcRequest'
      responses:
        200:
          description: add for device_generic_resrc
          schema: 
              $ref: '#/definitions/adddevice_generic_resrcResponse'
        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_generic_resrcRequest:
    type: object
    required:
      - device_generic_resrc
    properties:
      device_generic_resrc:
        $ref: '#/definitions/device_generic_resrc_readwrite'
    title: adddevice_generic_resrcRequest
    example:
      device_generic_resrc:
        failure_action: "string_value"
        sync: "false"
        payload: "string_value"
        device_family_type: "ns"
        ipaddress: "1.1.1.1"
        resource_type: "managed_device"

  adddevice_generic_resrcResponse:
    type: object
    required:
      - device_generic_resrc
    properties:
      device_generic_resrc:
        $ref: '#/definitions/device_generic_resrc'
    title: adddevice_generic_resrcResponse
    example:
      device_generic_resrc:
        act_id: "967cb019-dcdb-49d3-b1c5-a5be3b0c5371"
        failure_action: "string_value"
        sync: "false"
        payload: "string_value"
        device_family_type: "ns"
        ipaddress: "1.1.1.1"
        resource_type: "managed_device"

  device_generic_resrc_readwrite:
    type: object
    properties:
      failure_action:
        description: "Action taken on failure "
        type: string
        format: string
      sync:
        description: "Ping SVM to check its status"
        type: boolean
        format: boolean
      payload:
        description: "Payload/Body Request "
        type: string
        format: string
      device_family_type:
        description: "Device family type"
        type: string
        format: string
        minLength: 1
      ipaddress:
        description: "List of SVM IP Address"
        type: array
        items:
          type: string
          format: ipaddress
        minLength: 1
        maxLength: 64
      resource_type:
        description: "Type of resource"
        type: string
        format: string
        minLength: 1

  device_generic_resrc:
    allOf:
      -
        properties:
          act_id:
             description: "Activity Id"
             type: string
             format: uuid
      - $ref: '#/definitions/device_generic_resrc_readwrite'

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