swagger: '2.0'
info:
  description: Configuration for Restore resource.
  version: 'v2'
  title: restore
host: 'adm.cloud.com'
schemes:
 - https
# tags are used for organizing operations
tags:
  - name: restore
    description: Restore
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/restore:
    get:
      tags:
        - restore
      summary: GET all restore
      operationId: getall_restore
      description: Use this operation to get restore component information
      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 restore 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 restore 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 restore resources.
          enum:
            - yes
      responses:
        200:
          description:  for restore
          schema: 
              $ref: '#/definitions/getrestoresResponse'
        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:
        - restore
      summary: POST operation for restore
      operationId: post_restore
      description: POST operation for restore
      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: body
          name: restore
          description: restore object
          schema:
              $ref: '#/definitions/addrestoreRequest'
      responses:
        200:
          description: add for restore
          schema: 
              $ref: '#/definitions/addrestoreResponse'
        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:
  addrestoreRequest:
    type: object
    required:
      - restore
    properties:
      restore:
        $ref: '#/definitions/restore_readwrite'
    title: addrestoreRequest
    example:
      restore:
        is_valid_license: "boolean_value"
        max_allowed_ns: "integer_value"
        restore_type: "0"
        backup_password: "string_value"
        required_ns: "integer_value"
        ip_address_list: ["string_value1","string_value2"]
        sbi_file: "string_value"
        backup_components: [{        component_message: "string_value"
,        component_versions: "string_value"
,        component_minimum_version: "string_value"
,        backup_file_name: "string_value"
,        component: "string_value"
,        component_name: "string_value"
,        component_ip: "string_value"
,        component_version_bit: "string_value"
,        component_hostname: "string_value"
,        component_error_severity: "integer_value"
}]
        required_throughput: "number_value"
        backup_file_name: "string_value"
        max_allowed_throughput: "number_value"

  addrestoreResponse:
    type: object
    required:
      - restore
    properties:
      restore:
        $ref: '#/definitions/restore'
    title: addrestoreResponse
    example:
      restore:
        is_valid_license: "boolean_value"
        max_allowed_ns: "integer_value"
        restore_type: "0"
        backup_password: "string_value"
        max_allowed_advanced_throughput: "number_value"
        required_ns: "integer_value"
        ip_address_list: ["string_value1","string_value2"]
        premium_throughput: "number_value"
        sbi_file: "string_value"
        act_id: "967cb019-dcdb-49d3-b1c5-a5be3b0c5371"
        backup_components: [{        component_message: "string_value"
,        component_versions: "string_value"
,        component_minimum_version: "string_value"
,        backup_file_name: "string_value"
,        component: "string_value"
,        component_name: "string_value"
,        component_ip: "string_value"
,        component_version_bit: "string_value"
,        component_hostname: "string_value"
,        component_error_severity: "integer_value"
}]
        standard_throughput: "number_value"
        required_throughput: "number_value"
        advanced_throughput: "number_value"
        backup_file_name: "string_value"
        is_pooled_license: "false"
        max_allowed_throughput: "number_value"
        max_allowed_standard_throughput: "number_value"
        max_allowed_premium_throughput: "number_value"

  getrestoreResponse:
    type: object
    required:
      - restore
    properties:
      restore:
        $ref: '#/definitions/restore'
    title: getrestoreResponse
    example:
      restore:
        is_valid_license: "boolean_value"
        max_allowed_ns: "integer_value"
        restore_type: "0"
        backup_password: "string_value"
        max_allowed_advanced_throughput: "number_value"
        required_ns: "integer_value"
        ip_address_list: ["string_value1","string_value2"]
        premium_throughput: "number_value"
        sbi_file: "string_value"
        act_id: "967cb019-dcdb-49d3-b1c5-a5be3b0c5371"
        backup_components: [{        component_message: "string_value"
,        component_versions: "string_value"
,        component_minimum_version: "string_value"
,        backup_file_name: "string_value"
,        component: "string_value"
,        component_name: "string_value"
,        component_ip: "string_value"
,        component_version_bit: "string_value"
,        component_hostname: "string_value"
,        component_error_severity: "integer_value"
}]
        standard_throughput: "number_value"
        required_throughput: "number_value"
        advanced_throughput: "number_value"
        backup_file_name: "string_value"
        is_pooled_license: "false"
        max_allowed_throughput: "number_value"
        max_allowed_standard_throughput: "number_value"
        max_allowed_premium_throughput: "number_value"

  getrestoresResponse:
    type: object
    required:
      - restore
    properties:
      restore:
        type: array
        items:
          $ref: '#/definitions/restore'
    title: getrestoresResponse
    example:
      restore:
        is_valid_license: "boolean_value"
        max_allowed_ns: "integer_value"
        restore_type: "0"
        backup_password: "string_value"
        max_allowed_advanced_throughput: "number_value"
        required_ns: "integer_value"
        ip_address_list: ["string_value1","string_value2"]
        premium_throughput: "number_value"
        sbi_file: "string_value"
        act_id: "967cb019-dcdb-49d3-b1c5-a5be3b0c5371"
        backup_components: [{        component_message: "string_value"
,        component_versions: "string_value"
,        component_minimum_version: "string_value"
,        backup_file_name: "string_value"
,        component: "string_value"
,        component_name: "string_value"
,        component_ip: "string_value"
,        component_version_bit: "string_value"
,        component_hostname: "string_value"
,        component_error_severity: "integer_value"
}]
        standard_throughput: "number_value"
        required_throughput: "number_value"
        advanced_throughput: "number_value"
        backup_file_name: "string_value"
        is_pooled_license: "false"
        max_allowed_throughput: "number_value"
        max_allowed_standard_throughput: "number_value"
        max_allowed_premium_throughput: "number_value"

  restore_readwrite:
    type: object
    properties:
      is_valid_license:
        description: "To indicate if available license is valid and (NS+throughput) sufficient for restore."
        type: boolean
        format: boolean
      max_allowed_ns:
        description: "Number of NetScaler instances current license allows to be restored."
        type: integer
        format: int32
      restore_type:
        description: " "
        type: integer
        format: int32
      backup_password:
        description: "Password of encrypted backup file"
        type: string
        format: password
      required_ns:
        description: "Total number of instances present in backup file."
        type: integer
        format: int32
      ip_address_list:
        description: "List of VM IP Address"
        type: array
        items:
          type: string
          format: IP Address
        minLength: 1
        maxLength: 1024
      sbi_file:
        description: "SDX Image selected by User for Restore"
        type: string
        format: string
      backup_components:
        type: array
        items:
          $ref: '#/definitions/backup_component_readwrite'
      required_throughput:
        description: "Throughput required by the backedup instances to get restored."
        type: number
        format: double
      backup_file_name:
        description: "Backup file name"
        type: string
        format: string
        maxLength: 64
      max_allowed_throughput:
        description: "Maximum throughput current license allows."
        type: number
        format: double

  restore:
    allOf:
      -
        properties:
          max_allowed_advanced_throughput:
             description: "Maximum allowed throughput under existing advanced license."
             type: number
             format: double
          premium_throughput:
             description: "Throughput from backup under premium license."
             type: number
             format: double
          act_id:
             description: "Activity Id"
             type: string
             format: string
          standard_throughput:
             description: "Throughput from backup under standard license."
             type: number
             format: double
          advanced_throughput:
             description: "Throughput from backup under advanced license."
             type: number
             format: double
          is_pooled_license:
             description: "Flag to indicate that current SDX is operating in pooled license"
             type: boolean
             format: boolean
          max_allowed_standard_throughput:
             description: "Maximum allowed throughput under existing standard license."
             type: number
             format: double
          max_allowed_premium_throughput:
             description: "Maximum allowed throughput under existing premium license."
             type: number
             format: double
      - $ref: '#/definitions/restore_readwrite'

  backup_component_readwrite:
    type: object
    properties:
      component_message:
        description: "Information about the componenet"
        type: string
        format: string
      component_versions:
        description: "Backup component version"
        type: string
        format: string
      component_minimum_version:
        description: "Minimum version supported by the NetScaler"
        type: string
        format: string
      backup_file_name:
        description: "Backup file name"
        type: string
        format: string
        maxLength: 64
      component:
        description: "Backup component"
        type: string
        format: string
      component_name:
        description: "Backup component Name"
        type: string
        format: string
      component_ip:
        description: "Backup component IPaddress"
        type: string
        format: string
      component_version_bit:
        description: "(32/64 bit) information for backup component version"
        type: string
        format: string
      component_hostname:
        description: "Backup component VM Name"
        type: string
        format: string
      component_error_severity:
        description: "Severity of error for the component"
        type: integer
        format: int32

  backup_component:
    allOf:
      - $ref: '#/definitions/backup_component_readwrite'

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