swagger: '2.0'
info:
  description: Configuration for Upgrade NetScaler resource.
  version: 'v2'
  title: ns_upgrade
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_upgrade
    description: Upgrade NetScaler
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/ns_upgrade:
    get:
      tags:
        - ns_upgrade
      summary: GET all ns_upgrade
      operationId: getall_ns_upgrade
      description: Use this operation to get ns 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: 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_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 ns_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 ns_upgrade resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_upgrade
          schema: 
              $ref: '#/definitions/getns_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:
        - ns_upgrade
      summary: POST operation for ns_upgrade
      operationId: post_ns_upgrade
      description: POST operation for ns_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: ns_upgrade
          description: ns_upgrade object
          schema:
              $ref: '#/definitions/addns_upgradeRequest'
      responses:
        200:
          description: upgrade for ns_upgrade
          schema: 
              $ref: '#/definitions/addns_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:
  addns_upgradeRequest:
    type: object
    required:
      - ns_upgrade
    properties:
      ns_upgrade:
        $ref: '#/definitions/ns_upgrade_readwrite'
    title: addns_upgradeRequest
    example:
      ns_upgrade:
        mode: "0"
        image_name: "build-12.1-56.1_nc_64.tgz"
        is_skip_upload_image: "false"
        cleanup_unsupported_policy: "false"
        slack_profile: "test_slack_profile"
        id: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5e"
        do_cleanup: "true"
        disable_build_image_upload_to_primary: "false"
        scheduleTimesEpoch: "1581031800"
        doc_file: "doc_file.tgz"
        name: "test_upgrade1"
        do_backup: "false"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        is_issu_enabled: "false"
        mail_profiles: "test_mail_profile"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        post_upgrade_script: "string_value"
        type: "SNIP"
        is_post_upgrade_pre_failover_script_selected: "false"
        saveconfig_enabled: "true"
        pre_upgrade_script: "string_value"
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        issu_migration_timeout: "150"
        is_post_upgrade_script_selected: "false"
        device_groups: "[instance-grp1, instance-grp2]"
        is_remote_download: "false"
        default_configdiff_template: "[saved_netscaler_config, running_netscaler_config, network_config, virtual_server_config, system_config, global_parameters_config]"
        post_upgrade_pre_failover_script: "string_value"
        ha_two_phase_upgrade: "false"
        second_failover_enabled: "true"
        is_pre_post_upgrade_script_same: "false"
        ha_node2_devices: "[\"1.1.1.1\"]"
        adc_cloud_image_id: "string_value"
        is_pre_upgrade_script_selected: "false"
        scheduleTimesEpoch2: "15850678800"
        is_pre_post_upgrade_pre_failover_script_same: "false"

  addns_upgradeResponse:
    type: object
    required:
      - ns_upgrade
    properties:
      ns_upgrade:
        $ref: '#/definitions/ns_upgrade'
    title: addns_upgradeResponse
    example:
      ns_upgrade:
        mode: "0"
        image_name: "build-12.1-56.1_nc_64.tgz"
        is_skip_upload_image: "false"
        cleanup_unsupported_policy: "false"
        slack_profile: "test_slack_profile"
        act_id: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5e"
        do_cleanup: "true"
        disable_build_image_upload_to_primary: "false"
        scheduleTimesEpoch: "1581031800"
        tasklog_id: "d970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        doc_file: "doc_file.tgz"
        name: "test_upgrade1"
        do_backup: "false"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        is_issu_enabled: "false"
        mail_profiles: "test_mail_profile"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        post_upgrade_script: "string_value"
        type: "SNIP"
        is_post_upgrade_pre_failover_script_selected: "false"
        saveconfig_enabled: "true"
        pre_upgrade_script: "string_value"
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        issu_migration_timeout: "150"
        is_post_upgrade_script_selected: "false"
        device_groups: "[instance-grp1, instance-grp2]"
        is_remote_download: "false"
        default_configdiff_template: "[saved_netscaler_config, running_netscaler_config, network_config, virtual_server_config, system_config, global_parameters_config]"
        post_upgrade_pre_failover_script: "string_value"
        ha_two_phase_upgrade: "false"
        second_failover_enabled: "true"
        is_pre_post_upgrade_script_same: "false"
        ha_node2_devices: "[\"1.1.1.1\"]"
        adc_cloud_image_id: "string_value"
        is_pre_upgrade_script_selected: "false"
        scheduleTimesEpoch2: "15850678800"
        is_pre_post_upgrade_pre_failover_script_same: "false"

  getns_upgradeResponse:
    type: object
    required:
      - ns_upgrade
    properties:
      ns_upgrade:
        $ref: '#/definitions/ns_upgrade'
    title: getns_upgradeResponse
    example:
      ns_upgrade:
        mode: "0"
        image_name: "build-12.1-56.1_nc_64.tgz"
        is_skip_upload_image: "false"
        cleanup_unsupported_policy: "false"
        slack_profile: "test_slack_profile"
        act_id: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5e"
        do_cleanup: "true"
        disable_build_image_upload_to_primary: "false"
        scheduleTimesEpoch: "1581031800"
        tasklog_id: "d970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        doc_file: "doc_file.tgz"
        name: "test_upgrade1"
        do_backup: "false"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        is_issu_enabled: "false"
        mail_profiles: "test_mail_profile"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        post_upgrade_script: "string_value"
        type: "SNIP"
        is_post_upgrade_pre_failover_script_selected: "false"
        saveconfig_enabled: "true"
        pre_upgrade_script: "string_value"
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        issu_migration_timeout: "150"
        is_post_upgrade_script_selected: "false"
        device_groups: "[instance-grp1, instance-grp2]"
        is_remote_download: "false"
        default_configdiff_template: "[saved_netscaler_config, running_netscaler_config, network_config, virtual_server_config, system_config, global_parameters_config]"
        post_upgrade_pre_failover_script: "string_value"
        ha_two_phase_upgrade: "false"
        second_failover_enabled: "true"
        is_pre_post_upgrade_script_same: "false"
        ha_node2_devices: "[\"1.1.1.1\"]"
        adc_cloud_image_id: "string_value"
        is_pre_upgrade_script_selected: "false"
        scheduleTimesEpoch2: "15850678800"
        is_pre_post_upgrade_pre_failover_script_same: "false"

  getns_upgradesResponse:
    type: object
    required:
      - ns_upgrade
    properties:
      ns_upgrade:
        type: array
        items:
          $ref: '#/definitions/ns_upgrade'
    title: getns_upgradesResponse
    example:
      ns_upgrade:
        mode: "0"
        image_name: "build-12.1-56.1_nc_64.tgz"
        is_skip_upload_image: "false"
        cleanup_unsupported_policy: "false"
        slack_profile: "test_slack_profile"
        act_id: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5e"
        do_cleanup: "true"
        disable_build_image_upload_to_primary: "false"
        scheduleTimesEpoch: "1581031800"
        tasklog_id: "d970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        doc_file: "doc_file.tgz"
        name: "test_upgrade1"
        do_backup: "false"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        is_issu_enabled: "false"
        mail_profiles: "test_mail_profile"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        post_upgrade_script: "string_value"
        type: "SNIP"
        is_post_upgrade_pre_failover_script_selected: "false"
        saveconfig_enabled: "true"
        pre_upgrade_script: "string_value"
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        issu_migration_timeout: "150"
        is_post_upgrade_script_selected: "false"
        device_groups: "[instance-grp1, instance-grp2]"
        is_remote_download: "false"
        default_configdiff_template: "[saved_netscaler_config, running_netscaler_config, network_config, virtual_server_config, system_config, global_parameters_config]"
        post_upgrade_pre_failover_script: "string_value"
        ha_two_phase_upgrade: "false"
        second_failover_enabled: "true"
        is_pre_post_upgrade_script_same: "false"
        ha_node2_devices: "[\"1.1.1.1\"]"
        adc_cloud_image_id: "string_value"
        is_pre_upgrade_script_selected: "false"
        scheduleTimesEpoch2: "15850678800"
        is_pre_post_upgrade_pre_failover_script_same: "false"

  modifyns_upgradeRequest:
    type: object
    required:
      - ns_upgrade
    properties:
      ns_upgrade:
        $ref: '#/definitions/ns_upgrade_readwrite'
    title: modifyns_upgradeRequest
    example:
      ns_upgrade:
        mode: "0"
        image_name: "build-12.1-56.1_nc_64.tgz"
        is_skip_upload_image: "false"
        cleanup_unsupported_policy: "false"
        slack_profile: "test_slack_profile"
        id: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5e"
        do_cleanup: "true"
        disable_build_image_upload_to_primary: "false"
        scheduleTimesEpoch: "1581031800"
        doc_file: "doc_file.tgz"
        name: "test_upgrade1"
        do_backup: "false"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        is_issu_enabled: "false"
        mail_profiles: "test_mail_profile"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        post_upgrade_script: "string_value"
        type: "SNIP"
        is_post_upgrade_pre_failover_script_selected: "false"
        saveconfig_enabled: "true"
        pre_upgrade_script: "string_value"
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        issu_migration_timeout: "150"
        is_post_upgrade_script_selected: "false"
        device_groups: "[instance-grp1, instance-grp2]"
        is_remote_download: "false"
        default_configdiff_template: "[saved_netscaler_config, running_netscaler_config, network_config, virtual_server_config, system_config, global_parameters_config]"
        post_upgrade_pre_failover_script: "string_value"
        ha_two_phase_upgrade: "false"
        second_failover_enabled: "true"
        is_pre_post_upgrade_script_same: "false"
        ha_node2_devices: "[\"1.1.1.1\"]"
        adc_cloud_image_id: "string_value"
        is_pre_upgrade_script_selected: "false"
        scheduleTimesEpoch2: "15850678800"
        is_pre_post_upgrade_pre_failover_script_same: "false"

  modifyns_upgradeResponse:
    type: object
    required:
      - ns_upgrade
    properties:
      ns_upgrade:
        $ref: '#/definitions/ns_upgrade'
    title: modifyns_upgradeResponse
    example:
      ns_upgrade:
        mode: "0"
        image_name: "build-12.1-56.1_nc_64.tgz"
        is_skip_upload_image: "false"
        cleanup_unsupported_policy: "false"
        slack_profile: "test_slack_profile"
        act_id: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        id: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5e"
        do_cleanup: "true"
        disable_build_image_upload_to_primary: "false"
        scheduleTimesEpoch: "1581031800"
        tasklog_id: "d970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        doc_file: "doc_file.tgz"
        name: "test_upgrade1"
        do_backup: "false"
        ns_ip_address_arr: "[\"1.1.1.1-1.1.1.2\", \"1.1.1.3\"]"
        is_issu_enabled: "false"
        mail_profiles: "test_mail_profile"
        scheduleId: "b970e730-6bc5-44c2-a2bf-8dd1382ffb5a"
        post_upgrade_script: "string_value"
        type: "SNIP"
        is_post_upgrade_pre_failover_script_selected: "false"
        saveconfig_enabled: "true"
        pre_upgrade_script: "string_value"
        adc_cloud_image_version: "a970e730-6bc5-44c2-a2bf-8dd1382ffb5f"
        issu_migration_timeout: "150"
        is_post_upgrade_script_selected: "false"
        device_groups: "[instance-grp1, instance-grp2]"
        is_remote_download: "false"
        default_configdiff_template: "[saved_netscaler_config, running_netscaler_config, network_config, virtual_server_config, system_config, global_parameters_config]"
        post_upgrade_pre_failover_script: "string_value"
        ha_two_phase_upgrade: "false"
        second_failover_enabled: "true"
        is_pre_post_upgrade_script_same: "false"
        ha_node2_devices: "[\"1.1.1.1\"]"
        adc_cloud_image_id: "string_value"
        is_pre_upgrade_script_selected: "false"
        scheduleTimesEpoch2: "15850678800"
        is_pre_post_upgrade_pre_failover_script_same: "false"

  ns_upgrade_readwrite:
    type: object
    properties:
      mode:
        description: "Provide 0 for uploading and installing the image, 1 for only uploading the image, 2 for only installing the image and 3 for upgrade pre-validation"
        type: integer
        format: int32
      image_name:
        description: "image_name"
        type: string
        format: string
        maxLength: 128
      is_skip_upload_image:
        description: "True, if skip upload build image"
        type: boolean
        format: boolean
      cleanup_unsupported_policy:
        description: "True, if user selected to delete unsupported policies after upgrade."
        type: boolean
        format: boolean
      slack_profile:
        description: "Slack profile"
        type: string
        format: string
      id:
        description: "Id is maintenance job id"
        type: string
        format: uuid
      do_cleanup:
        description: "True, if user wants to clean the image files once upgrade is completed successfully"
        type: boolean
        format: boolean
      disable_build_image_upload_to_primary:
        description: "True, if disable build image upload to HA primary device"
        type: boolean
        format: boolean
      scheduleTimesEpoch:
        description: "Schedule time epoch (string representation of 11 digit numbers)."
        type: string
        format: string
      doc_file:
        description: "Documentation File Name"
        type: string
        format: string
        minLength: 1
        maxLength: 128
      name:
        description: "Name of upgrade"
        type: string
        format: string
        maxLength: 128
      do_backup:
        description: "True, if user wants to take backup before ns upgrade"
        type: boolean
        format: boolean
      ns_ip_address_arr:
        description: "List of NetScaler IP Address"
        type: array
        items:
          type: string
          format: IP Address
      is_issu_enabled:
        description: "True, if ISSU is enabled"
        type: boolean
        format: boolean
      mail_profiles:
        description: "Comma separated list of Mail profiles"
        type: string
        format: string
      scheduleId:
        description: "scheduleId is used to refer maintenaince schedule task"
        type: string
        format: uuid
      post_upgrade_script:
        description: "Name of post upgrade script file"
        type: string
        format: string
        maxLength: 128
      type:
        description: "Device type for NS device family"
        type: string
        format: string
        maxLength: 64
      is_post_upgrade_pre_failover_script_selected:
        description: "True, if post upgrade pre failover custom script is selected"
        type: boolean
        format: boolean
      saveconfig_enabled:
        description: "True, if save config before upgrade"
        type: boolean
        format: boolean
      pre_upgrade_script:
        description: "Name of pre upgrade script file"
        type: string
        format: string
        maxLength: 128
      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
      issu_migration_timeout:
        description: "ISSU migration timeout value in minutes"
        type: integer
        format: int32
      is_post_upgrade_script_selected:
        description: "True, if post upgrade custom script is selected"
        type: boolean
        format: boolean
      device_groups:
        description: "Device Group Array on which for which job is run"
        type: array
        items:
          type: string
          format: string
      is_remote_download:
        description: "True if upgrade is remote download instead of direct upload from NetScaler Console"
        type: boolean
        format: boolean
      default_configdiff_template:
        description: "List of default upgrade templates"
        type: array
        items:
          type: string
          format: string
      post_upgrade_pre_failover_script:
        description: "Name of post upgrade pre failover script file"
        type: string
        format: string
        maxLength: 128
      ha_two_phase_upgrade:
        description: "True, if user wants to upgarde ha in two phases or steps"
        type: boolean
        format: boolean
      second_failover_enabled:
        description: "True, if second failover for HA upgrade is enabled"
        type: boolean
        format: boolean
      is_pre_post_upgrade_script_same:
        description: "True, if pre and post upgrade post failover custom scripts are same"
        type: boolean
        format: boolean
      ha_node2_devices:
        description: "List of HA NetScaler IP Address upgrade in second phase"
        type: array
        items:
          type: string
          format: IP Address
      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
      is_pre_upgrade_script_selected:
        description: "True, if pre upgrade custom script is selected"
        type: boolean
        format: boolean
      scheduleTimesEpoch2:
        description: "Schedule time epoch for ha primary node (string representation of 11 digit numbers)."
        type: string
        format: string
      is_pre_post_upgrade_pre_failover_script_same:
        description: "True, if pre and post upgrade pre failover custom scripts are same"
        type: boolean
        format: boolean

  ns_upgrade:
    allOf:
      -
        properties:
          act_id:
             description: "Activity Id"
             type: string
             format: uuid
          tasklog_id:
             description: "Task Log Id of the Config Job"
             type: string
             format: uuid
             minLength: 1
             maxLength: 128
      - $ref: '#/definitions/ns_upgrade_readwrite'

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