swagger: '2.0'
info:
  description: Configuration for Citrix ADC VM Image File For All Supported Hypervisor Types resource.
  version: 'v2'
  title: ns_vm_image
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_vm_image
    description: Citrix ADC VM Image File For All Supported Hypervisor Types
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  UserSecurity:
    type: basic
security:
  - UserSecurity: []
parameters:
  idParam:
   name: file_name
   in: path
   type: string
   description: File Name
   required: true
  authParam:
      in: header
      name: Authorization
      type: string
      required: true
      description: Session Id for authentication.Should be mentioned in the format CwcAuth 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/ns_vm_image:
    get:
      tags:
        - ns_vm_image
      summary: GET all ns_vm_image
      operationId: getall_ns_vm_image
      description: Use this operation to get Citrix ADC XVA 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 CwcAuth 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 ns_vm_image 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 ns_vm_image 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 ns_vm_image resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_vm_image
          schema: 
              $ref: '#/definitions/getns_vm_imagesResponse'
        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'

  /massvc/{customerid}/nitro/v2/config/ns_vm_image/{file_name}:
    get:
      tags:
        - ns_vm_image
      summary: GET by key for ns_vm_image
      operationId: getbykey_ns_vm_image
      description: Use this operation to get Citrix ADC XVA 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 CwcAuth 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 ns_vm_image
          schema: 
              $ref: '#/definitions/getns_vm_imageResponse'
        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'

  /massvc/{customerid}/nitro/v2/download/ns_vm_image/{file_name}:
    get:
      tags:
        - ns_vm_image
      summary: Download operation for ns_vm_image
      operationId: download_ns_vm_image
      description: Use this operation to download Citrix ADC XVA 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 CwcAuth 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: File Name
      responses:
        200:
          description: Successful download for ns_vm_image
          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'

definitions:
  getns_vm_imageResponse:
    type: object
    required:
      - ns_vm_image
    properties:
      ns_vm_image:
        $ref: '#/definitions/ns_vm_image'
    title: getns_vm_imageResponse
    example:
      ns_vm_image:
        file_size: "44335762"
        file_name: "build-13.0-43.11_nc_64.tgz"
        file_last_modified: "1580949032"
        file_last_modified_epoch: "1579734319"

  getns_vm_imagesResponse:
    type: object
    required:
      - ns_vm_image
    properties:
      ns_vm_image:
        type: array
        items:
          $ref: '#/definitions/ns_vm_image'
    title: getns_vm_imagesResponse
    example:
      ns_vm_image:
        file_size: "44335762"
        file_name: "build-13.0-43.11_nc_64.tgz"
        file_last_modified: "1580949032"
        file_last_modified_epoch: "1579734319"


  ns_vm_image:
    allOf:
      -
        properties:
          file_name:
            description: File Name
            type: string
            format: string
          file_size:
             description: "file_size"
             type: integer
             format: int32
          file_last_modified:
             description: "Last Modified"
             type: string
             format: string
             minLength: 1
             maxLength: 128
          file_last_modified_epoch:
             description: "Last Modified (Epoch)"
             type: number
             format: int64

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