swagger: '2.0'
info:
  description: Configuration for Technical Support resource.
  version: 'v2'
  title: techsupport
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: techsupport
    description: Technical Support
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: file_name
   in: path
   type: string
   description: Technical support File Name
   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/techsupport:
    get:
      tags:
        - techsupport
      summary: GET all techsupport
      operationId: getall_techsupport
      description: Use this operation to get technical support file
      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 techsupport 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 techsupport 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 techsupport resources.
          enum:
            - yes
      responses:
        200:
          description:  for techsupport
          schema: 
              $ref: '#/definitions/gettechsupportsResponse'
        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/techsupport/{file_name}:
    get:
      tags:
        - techsupport
      summary: GET by key for techsupport
      operationId: getbykey_techsupport
      description: Use this operation to get technical support file
      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 techsupport
          schema: 
              $ref: '#/definitions/gettechsupportResponse'
        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:
        - techsupport
      summary: POST operation with actions for techsupport
      operationId: post_techsupport_actions
      description: POST operation with actions for techsupport
      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: query
          name: action
          type: string
          required: true
          enum: [start]
          description: >
            actions:
              * `start` - 

        - in: body
          name: techsupport
          description: techsupport object
          schema:
              $ref: '#/definitions/addtechsupportRequest'
      responses:
        200:
          description: start for techsupport
          schema: 
              $ref: '#/definitions/addtechsupportResponse'
        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:
        - techsupport
      summary: Delete for techsupport
      operationId: deletebykey_techsupport
      description: Use this operation to delete technical support file
      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: start for techsupport
        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/download/techsupport/{file_name}:
    get:
      tags:
        - techsupport
      summary: Download operation for techsupport
      operationId: download_techsupport
      description: Use this operation to download Techsupport file
      consumes:
        - application/json
      produces:
        - attachment
      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: path
          name: file_name
          type: string
          required: true
          description: Technical support File Name
      responses:
        200:
          description: Successful download for techsupport
          schema: 
              type: file
              format: binary
        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:
  addtechsupportRequest:
    type: object
    required:
      - techsupport
    properties:
      techsupport:
        $ref: '#/definitions/techsupport_readwrite'
    title: addtechsupportRequest
    example:
      techsupport:
        mode: "Management Service"
        file_location_path: "C:\\myfiles"

  addtechsupportResponse:
    type: object
    required:
      - techsupport
    properties:
      techsupport:
        $ref: '#/definitions/techsupport'
    title: addtechsupportResponse
    example:
      techsupport:
        enable_debug: "false"
        file_size: "8156768"
        mode: "Management Service"
        file_last_modified: "1579734319"
        enable_db_distribution: "false"
        file_location_path: "C:\\myfiles"
        file_name: "filename"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        vpx_list_for_techsupport: ["string_value1","string_value2"]
        debug_duration: "5"
        collect_options: "none"
        file_last_modified_epoch: "1579734319"

  gettechsupportResponse:
    type: object
    required:
      - techsupport
    properties:
      techsupport:
        $ref: '#/definitions/techsupport'
    title: gettechsupportResponse
    example:
      techsupport:
        enable_debug: "false"
        file_size: "8156768"
        mode: "Management Service"
        file_last_modified: "1579734319"
        enable_db_distribution: "false"
        file_location_path: "C:\\myfiles"
        file_name: "filename"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        vpx_list_for_techsupport: ["string_value1","string_value2"]
        debug_duration: "5"
        collect_options: "none"
        file_last_modified_epoch: "1579734319"

  gettechsupportsResponse:
    type: object
    required:
      - techsupport
    properties:
      techsupport:
        type: array
        items:
          $ref: '#/definitions/techsupport'
    title: gettechsupportsResponse
    example:
      techsupport:
        enable_debug: "false"
        file_size: "8156768"
        mode: "Management Service"
        file_last_modified: "1579734319"
        enable_db_distribution: "false"
        file_location_path: "C:\\myfiles"
        file_name: "filename"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        vpx_list_for_techsupport: ["string_value1","string_value2"]
        debug_duration: "5"
        collect_options: "none"
        file_last_modified_epoch: "1579734319"

  techsupport_readwrite:
    type: object
    properties:
      mode:
        description: "Technical support Mode, Possible values Appliance | XenServer | Management Service | Appliance_full | Instances"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      file_location_path:
        description: "File Location on Client for upload/download"
        type: string
        format: string

  techsupport:
    allOf:
      -
        properties:
          file_name:
            description: Technical support File Name
            type: string
            format: string
          file_size:
             description: "File Size"
             type: number
             format: int32
          file_last_modified:
             description: "Last Modified Time"
             type: string
             format: int32
             minLength: 1
             maxLength: 128
          file_last_modified_epoch:
             description: "Last Modified (Epoch)"
             type: number
             format: int32
      - $ref: '#/definitions/techsupport_readwrite'

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