swagger: '2.0'
info:
  description: Configuration for Pre Upgrade fro NetScaler resource.
  version: 'v2'
  title: ns_pre_upgrade
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: ns_pre_upgrade
    description: Pre Upgrade fro 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_pre_upgrade:
    get:
      tags:
        - ns_pre_upgrade
      summary: GET all ns_pre_upgrade
      operationId: getall_ns_pre_upgrade
      description: Use this operation to get pre upgarde 
      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_pre_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_pre_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_pre_upgrade resources.
          enum:
            - yes
      responses:
        200:
          description:  for ns_pre_upgrade
          schema: 
              $ref: '#/definitions/getns_pre_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'

definitions:
  getns_pre_upgradeResponse:
    type: object
    required:
      - ns_pre_upgrade
    properties:
      ns_pre_upgrade:
        $ref: '#/definitions/ns_pre_upgrade'
    title: getns_pre_upgradeResponse
    example:
      ns_pre_upgrade:
        primary_config_error: "[add lbvserver, add csvserver]"
        image_var_nsinstall: "string_value"
        policy_check_details: "add policy expression policy1"
        disk_space_error_details: "string_value"
        secondary_config_error: "[add lbvserver, add csvserver]"
        ha_master_state: "Primary"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        hardware_error: "string_value"
        ip_address: "1.1.1.1"
        build_image_error: "string_value"
        config_error: "string_value"
        hardware_error_details: "string_value"
        connectivity_error_details: "string_value"
        disk_space_error: "string_value"
        display_name: "1.1.1.1-1.1.1.2"
        ha_ip_address: "1.1.1.2"
        policy_check: "Found unsupported classic policies"
        user_custom_info: "string_value"
        connectivity_error: "NetScaler is unreachable"
        user_custom_info_details: "string_value"

  getns_pre_upgradesResponse:
    type: object
    required:
      - ns_pre_upgrade
    properties:
      ns_pre_upgrade:
        type: array
        items:
          $ref: '#/definitions/ns_pre_upgrade'
    title: getns_pre_upgradesResponse
    example:
      ns_pre_upgrade:
        primary_config_error: "[add lbvserver, add csvserver]"
        image_var_nsinstall: "string_value"
        policy_check_details: "add policy expression policy1"
        disk_space_error_details: "string_value"
        secondary_config_error: "[add lbvserver, add csvserver]"
        ha_master_state: "Primary"
        act_id: "fce5b825-9217-4e58-b80c-48cfe8f0c6b3"
        hardware_error: "string_value"
        ip_address: "1.1.1.1"
        build_image_error: "string_value"
        config_error: "string_value"
        hardware_error_details: "string_value"
        connectivity_error_details: "string_value"
        disk_space_error: "string_value"
        display_name: "1.1.1.1-1.1.1.2"
        ha_ip_address: "1.1.1.2"
        policy_check: "Found unsupported classic policies"
        user_custom_info: "string_value"
        connectivity_error: "NetScaler is unreachable"
        user_custom_info_details: "string_value"

  ns_pre_upgrade_readwrite:
    type: object
    properties:
      primary_config_error:
        description: "NetScaler HA configuration inconsistency error between primary and secondary server"
        type: string
        format: string
      image_var_nsinstall:
        description: "Build images available in /var/nsinstall directory"
        type: string
        format: string
      policy_check_details:
        description: "List of unsupported policies."
        type: string
        format: string
      disk_space_error_details:
        description: "Disk space error for /var"
        type: string
        format: string
      secondary_config_error:
        description: "NetScaler HA configuration inconsistency error between primary and secondary server"
        type: string
        format: string
      ha_master_state:
        description: "Master State (Primary/Secondary)"
        type: string
        format: string
        maxLength: 32
      hardware_error:
        description: "Hardware error like HDD error"
        type: string
        format: string
      ip_address:
        description: "IP Address"
        type: string
        format: IP Address
      build_image_error:
        description: "Build image error for selected platform"
        type: string
        format: string
      config_error:
        description: "Config error if compatible configuration file not found"
        type: string
        format: string
      hardware_error_details:
        description: "Hardware error like HDD error details"
        type: string
        format: string
      connectivity_error_details:
        description: "NetScaler connectivity error details"
        type: string
        format: string
      disk_space_error:
        description: "Disk space error for /var"
        type: string
        format: string
      ha_ip_address:
        description: "Peer IP Address"
        type: string
        format: ipaddress
        maxLength: 64
      policy_check:
        description: "Detected unsupported policy"
        type: string
        format: string
        maxLength: 64
      user_custom_info:
        description: "User custom info"
        type: string
        format: string
      connectivity_error:
        description: "NetScaler connectivity error"
        type: string
        format: string
        maxLength: 256
      user_custom_info_details:
        description: "User custom info details"
        type: string
        format: string

  ns_pre_upgrade:
    allOf:
      -
        properties:
          act_id:
             description: "Activity Id"
             type: string
             format: string
          display_name:
             description: "Display Name for this managed device. For HA pair it will be A-B, and for Cluster it will be CLIP"
             type: string
             format: string
             maxLength: 128
      - $ref: '#/definitions/ns_pre_upgrade_readwrite'

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