swagger: '2.0'
info:
  description: Configuration for Upgrade support for AutoScaleGroup resource.
  version: 'v2'
  title: autoscalegroup_upgrade
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: autoscalegroup_upgrade
    description: Upgrade support for AutoScaleGroup
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/autoscalegroup_upgrade:
    get:
      tags:
        - autoscalegroup_upgrade
      summary: GET all autoscalegroup_upgrade
      operationId: getall_autoscalegroup_upgrade
      description: Use this operation to get image names for the corresponding NetScaler Cloud Images.
      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 autoscalegroup_upgrade 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 autoscalegroup_upgrade 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 autoscalegroup_upgrade resources.
          enum:
            - yes
      responses:
        200:
          description:  for autoscalegroup_upgrade
          schema: 
              $ref: '#/definitions/getautoscalegroup_upgradesResponse'
        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:
        - autoscalegroup_upgrade
      summary: POST operation for autoscalegroup_upgrade
      operationId: post_autoscalegroup_upgrade
      description: POST operation for autoscalegroup_upgrade
      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: query
          name: action
          type: string
          required: false
          enum: [upgrade]
          description: >
            actions:
              * `upgrade` - 

        - in: body
          name: autoscalegroup_upgrade
          description: autoscalegroup_upgrade object
          schema:
              $ref: '#/definitions/addautoscalegroup_upgradeRequest'
      responses:
        200:
          description: upgrade for autoscalegroup_upgrade
          schema: 
              $ref: '#/definitions/addautoscalegroup_upgradeResponse'
        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:
  addautoscalegroup_upgradeRequest:
    type: object
    required:
      - autoscalegroup_upgrade
    properties:
      autoscalegroup_upgrade:
        $ref: '#/definitions/autoscalegroup_upgrade_readwrite'
    title: addautoscalegroup_upgradeRequest
    example:
      autoscalegroup_upgrade:
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_force_upgrade: "f"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        autoscalegroup_id: "asg1,asg2"
        adc_cloud_image_id: "string_value"

  addautoscalegroup_upgradeResponse:
    type: object
    required:
      - autoscalegroup_upgrade
    properties:
      autoscalegroup_upgrade:
        $ref: '#/definitions/autoscalegroup_upgrade'
    title: addautoscalegroup_upgradeResponse
    example:
      autoscalegroup_upgrade:
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_force_upgrade: "f"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        autoscalegroup_id: "asg1,asg2"
        adc_cloud_image_id: "string_value"

  getautoscalegroup_upgradeResponse:
    type: object
    required:
      - autoscalegroup_upgrade
    properties:
      autoscalegroup_upgrade:
        $ref: '#/definitions/autoscalegroup_upgrade'
    title: getautoscalegroup_upgradeResponse
    example:
      autoscalegroup_upgrade:
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_force_upgrade: "f"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        autoscalegroup_id: "asg1,asg2"
        adc_cloud_image_id: "string_value"

  getautoscalegroup_upgradesResponse:
    type: object
    required:
      - autoscalegroup_upgrade
    properties:
      autoscalegroup_upgrade:
        type: array
        items:
          $ref: '#/definitions/autoscalegroup_upgrade'
    title: getautoscalegroup_upgradesResponse
    example:
      autoscalegroup_upgrade:
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        is_force_upgrade: "f"
        activity_id: "c970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        autoscalegroup_id: "asg1,asg2"
        adc_cloud_image_id: "string_value"

  autoscalegroup_upgrade_readwrite:
    type: object
    properties:
      adc_cloud_image_version:
        description: "NetScaler Cloud Image Version to which AutoScaleGroup(s) is/are to be upgraded"
        type: string
        format: uuid
        minLength: 1
        maxLength: 128
      is_force_upgrade:
        description: "Force upgrade of AutoScaleGroup would mean to ignore Drain connection timeout"
        type: boolean
        format: boolean
      activity_id:
        description: "Most recent activity_id of this autoscalegroup"
        type: string
        format: uuid
        maxLength: 128
      autoscalegroup_id:
        description: "AutoScaleGroup ID"
        type: string
        format: string
      adc_cloud_image_id:
        description: "NetScaler Cloud Image ID to which AutoScaleGroup(s) is/are to be upgraded"
        type: string
        format: string
        minLength: 1
        maxLength: 128

  autoscalegroup_upgrade:
    allOf:
      - $ref: '#/definitions/autoscalegroup_upgrade_readwrite'

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