$schema: http://support.riverbed.com/apis/service_def/2.2
description: Backup, Restore, and Reset Factory operations
id: http://support.riverbed.com/apis/npm.backup/2.0
name: npm.backup
provider: riverbed
resources:
  backups:
    additionalProperties: false
    description: Backups
    links:
      get:
        description: Get backups
        method: GET
        response:
          $ref: '#/resources/backups'
      self:
        path: $/backups/server/{server_id}
      start:
        description: Start a backup
        method: POST
        path: $/backups/server/{server_id}/start
        request:
          properties:
            contents:
              $ref: '#/types/content_info'
            desc:
              description: Description
              type: string
            name:
              description: Name
              type: string
          required:
          - name
          - desc
          - contents
          type: object
        response:
          $ref: '#/types/operation_info'
      upload:
        description: 'Upload a backup file. A backup file is obtained from the download
          link on a backup resource.  The accepted content-type is application/octet-stream.
          Available for local backups only.

          '
        method: POST
        path: $/backups/server/{server_id}/upload
        response:
          $ref: '#/resources/completed_backup'
        tags:
          media_types:
          - application/octet-stream
    properties:
      completed:
        description: List of completed backups
        items:
          $ref: '#/resources/completed_backup'
        type: array
      server_id:
        description: ID of the backup server (filer)
        type: integer
    required:
    - server_id
    - completed
    type: object
  completed_backup:
    additionalProperties: false
    description: A backup stored on a server
    links:
      delete:
        description: Delete a backup
        method: DELETE
      download:
        description: 'Retrieve the backup file.  This link returns binary data.  Available
          for local backups only.

          '
        method: GET
        path: $/completed_backups/server/{server_id}/items/{id}/file
        tags:
          media_types:
          - application/octet-stream
          - application/x-gzip
      get:
        description: Get a backup
        method: GET
        response:
          $ref: '#/resources/completed_backup'
      restore:
        description: Restore a backup
        method: POST
        path: $/completed_backups/server/{server_id}/items/{id}/restore
        request:
          $ref: '#/types/content_info'
        response:
          $ref: '#/types/operation_info'
      self:
        path: $/completed_backups/server/{server_id}/items/{id}
    properties:
      contents:
        $ref: '#/types/content_info'
      created_on:
        description: Creation timestamp
        readOnly: true
        type: integer
      desc:
        description: Description
        type: string
      hostname:
        description: Hostname
        readOnly: true
        type: string
      id:
        description: ID (uuid)
        readOnly: true
        type: string
      model:
        description: Model
        readOnly: true
        type: string
      name:
        description: Name
        type: string
      serial:
        description: Serial
        readOnly: true
        type: string
      server_id:
        description: ID of the backup server (filer)
        readOnly: true
        type: integer
      sid:
        description: ID of associated scheduled backup
        readOnly: true
        type: string
      size:
        description: Size in bytes
        readOnly: true
        type: integer
      status:
        $ref: '#/types/status'
      sw_version:
        description: Software version
        readOnly: true
        type: string
    required:
    - id
    - name
    - desc
    - server_id
    - status
    - hostname
    - sw_version
    - model
    - serial
    - created_on
    - contents
    - size
    type: object
  device_status:
    additionalProperties: false
    description: Backup and Restore status
    links:
      cancel_operation:
        description: Cancel current operation
        method: POST
        path: $/device_status/cancel_operation
      estimate_size:
        description: Get a backup size estimate
        method: POST
        path: $/device_status/estimate_size
        request:
          $ref: '#/types/content_info'
        response:
          $ref: '#/types/backup_size'
      get:
        description: Get current status
        method: GET
        response:
          $ref: '#/resources/device_status'
      reset_factory:
        description: 'Reset the appliance to its initial configuration, wiping out
          all configuration, logs, and data

          '
        method: POST
        path: $/device_status/reset_factory
        response:
          $ref: '#/types/operation_info'
      self:
        path: $/device_status
    properties:
      available_backup_modules:
        items:
          $ref: '#/types/module'
        type: array
      available_restore_modules:
        items:
          $ref: '#/types/module'
        type: array
      current_operation:
        additionalProperties: false
        description: Information about the current operation
        oneOf:
        - additionalProperties: true
          properties:
            backup_details:
              $ref: '#/types/operation_details_backup'
            info:
              additionalProperties: true
              properties:
                operation_type:
                  enum:
                  - backup
                  type: string
              required:
              - operation_type
              type: object
          required:
          - info
          - backup_details
          type: object
        - additionalProperties: true
          properties:
            info:
              additionalProperties: true
              properties:
                operation_type:
                  enum:
                  - restore
                  type: string
              required:
              - operation_type
              type: object
            restore_details:
              $ref: '#/types/operation_details_restore'
          required:
          - info
          - restore_details
          type: object
        properties:
          backup_details:
            $ref: '#/types/operation_details_backup'
          info:
            $ref: '#/types/operation_info'
          progress:
            additionalProperties: false
            description: Progress report
            properties:
              completed:
                description: Number of steps completed so far
                type: integer
              status_message:
                description: Information about the current step
                type: string
              total:
                description: Total number of steps
                type: integer
            required:
            - completed
            - total
            - status_message
            type: object
          restore_details:
            $ref: '#/types/operation_details_restore'
        required:
        - info
        - progress
        type: object
      latest_backup:
        $ref: '#/types/operation_info'
      latest_restore:
        $ref: '#/types/operation_info'
      system_id:
        description: System identifier
        type: string
    required:
    - available_backup_modules
    - available_restore_modules
    - system_id
    type: object
  scheduled_backup:
    additionalProperties: false
    description: A schedule backup
    links:
      backup_now:
        description: Start the scheduled backup now
        method: POST
        path: $/scheduled_backups/items/{id}/backup_now
        response:
          $ref: '#/types/operation_info'
      delete:
        description: Delete a scheduled backup
        method: DELETE
      get:
        description: Get a scheduled backup
        method: GET
        response:
          $ref: '#/resources/scheduled_backup'
      self:
        path: $/scheduled_backups/items/{id}
      set:
        description: Update scheduled backup
        method: PUT
        request:
          $ref: '#/resources/scheduled_backup'
        response:
          $ref: '#/resources/scheduled_backup'
    properties:
      active:
        description: Scheduled backup is active
        type: boolean
      contents:
        $ref: '#/types/content_info'
      desc:
        description: Description
        type: string
      id:
        description: ID (uuid)
        readOnly: true
        type: string
      last_backup:
        description: Timestamp that backup last occurred
        readOnly: true
        type: integer
      name:
        description: Name
        type: string
      next_backup:
        description: Timestamp that next backup will occur
        readOnly: true
        type: integer
      retention:
        description: Specifies number of backups to retain
        maximum: 9999
        minimum: 1
        type: integer
      retry_attempts:
        description: Specifies number of times to retry failed backup attempts
        maximum: 9999
        minimum: 0
        type: integer
      retry_delay:
        description: Specifies number of minutes between retry attempts
        maximum: 9999
        minimum: 0
        type: integer
      rrule:
        $ref: '#/types/recurrence_rule'
      server_id:
        description: ID of backup_server to send backup to
        relations:
          full:
            resource: '#/resources/servers'
            vars:
              id: '0'
        type: integer
    relations:
      instances:
        resource: '#/resources/scheduled_backups'
    required:
    - name
    - desc
    - active
    - retry_attempts
    - retry_delay
    - retention
    - server_id
    - contents
    - rrule
    type: object
  scheduled_backups:
    additionalProperties: false
    description: Scheduled backups
    links:
      create:
        description: Add a scheduled backup
        method: POST
        request:
          $ref: '#/resources/scheduled_backup'
        response:
          $ref: '#/resources/scheduled_backup'
      get:
        description: Get scheduled backup
        method: GET
        response:
          $ref: '#/resources/scheduled_backups'
      self:
        path: $/scheduled_backups
    properties:
      items:
        description: List of scheduled backups
        items:
          $ref: '#/resources/scheduled_backup'
        type: array
    type: object
  server:
    additionalProperties: false
    description: Backup server (filer)
    links:
      delete:
        description: Delete a server
        method: DELETE
      generate_key:
        description: 'Generate a new RSA keypair and update the server resource with
          the new keypair. The response to this call will contain the newly generated
          private key, which will be the only time that the private key will be made
          available. The response will also contain the public key.

          '
        method: POST
        path: $/servers/items/{id}/generate_key
        response:
          $ref: '#/resources/server'
      get:
        description: Get a server
        method: GET
        response:
          $ref: '#/resources/server'
      self:
        path: $/servers/items/{id}
      set:
        description: Update a server
        method: PUT
        request:
          $ref: '#/resources/server'
        response:
          $ref: '#/resources/server'
      test:
        description: Test server connection
        method: POST
        path: $/servers/items/{id}/test
        response:
          additionalProperties: false
          description: Server connection test result
          properties:
            message:
              description: Contains failure information if test fails
              type: string
            success:
              description: Indicates test success or failure
              type: boolean
          required:
          - success
          - message
          type: object
    properties:
      desc:
        description: Description
        type: string
      host:
        description: Host
        type: string
      id:
        description: ID
        readOnly: true
        type: integer
      name:
        description: Name
        type: string
      new_private_key:
        description: 'RSA Private Key. Set this during create or update to configure
          the key. If not set during create then a key will be generated automatically
          and will be returned in this field in the response.

          '
        type: string
      path:
        description: Path
        type: string
      port:
        description: Port
        type: integer
      public_key:
        description: 'RSA Public Key. The public key will be available every time
          the resource is queried.

          '
        readOnly: true
        type: string
      user:
        description: User
        type: string
    relations:
      instances:
        resource: '#/resources/servers'
    required:
    - name
    - desc
    - host
    - port
    - path
    - user
    type: object
  servers:
    additionalProperties: false
    description: Backup servers (filers)
    links:
      create:
        description: Add a server
        method: POST
        request:
          $ref: '#/resources/server'
        response:
          $ref: '#/resources/server'
      get:
        description: Get servers
        method: GET
        response:
          $ref: '#/resources/servers'
      self:
        path: $/servers
    properties:
      items:
        description: List of servers
        items:
          $ref: '#/resources/server'
        type: array
    type: object
title: Backup and Restore
types:
  backup_size:
    additionalProperties: false
    description: Backup size
    properties:
      data_size:
        items:
          properties:
            module:
              description: Module short_name
              type: string
            size:
              description: Size in kilobytes
              type: integer
          type: object
        type: array
      total_size:
        description: Total size
        type: integer
    required:
    - total_size
    - data_size
    type: object
  backup_status:
    additionalProperties: true
    description: Information about a backup
    properties:
      backup_id:
        description: Backup ID
        type: string
      name:
        description: Name
        type: string
      operation_type:
        enum:
        - backup
        type: string
      sbu_id:
        description: SBU ID
        type: string
      server_name:
        description: Backup server (filer) name
        type: string
    required:
    - operation_type
    - name
    - server_name
    - backup_id
    type: object
  content_info:
    additionalProperties: false
    description: 'Content information describes what a backup contains and what a
      restore operation restores

      '
    properties:
      config_only:
        description: 'Configuration data only. When restoring, setting this flag to
          True will force a config-only restore. The flag has no  effect if the backup
          is already config-only.

          '
        type: boolean
      modules:
        $ref: '#/types/module_list'
    required:
    - config_only
    type: object
  factory_reset_status:
    additionalProperties: true
    description: Information about a factory reset
    properties:
      operation_type:
        enum:
        - reset-factory
        type: string
    required:
    - operation_type
    type: object
  module:
    additionalProperties: false
    description: A backup module
    properties:
      desc:
        description: Description
        maxLength: 500
        type: string
      group:
        description: Module group
        maxLength: 128
        type: string
      group_type:
        description: Type of data (transaction, aggregate, etc)
        type: string
      short_name:
        description: Short identifier
        maxLength: 32
        pattern: '[A-Za-z0-9]+'
        type: string
      supported_options:
        description: List of available option names
        items:
          type: string
        type: array
    required:
    - short_name
    - group
    - desc
    - group_type
    - supported_options
    type: object
  module_list:
    items:
      additionalProperties: false
      properties:
        module:
          description: Module short_name
          type: string
        options:
          description: list of option names and values
          items:
            properties:
              name:
                description: Parameter name
                type: string
              value:
                description: Parameter value
                type: string
            type: object
          type: array
      required:
      - module
      - options
      type: object
    type: array
  operation_details_backup:
    additionalProperties: false
    description: Backup operation details
    properties:
      contents:
        $ref: '#/types/content_info'
      size_estimate:
        $ref: '#/types/backup_size'
    required:
    - size_estimate
    - contents
    type: object
  operation_details_restore:
    additionalProperties: false
    description: Restore operation details
    properties:
      size:
        description: Size in bytes
        type: integer
    required:
    - size
    type: object
  operation_info:
    additionalProperties: true
    description: Backup operation information
    oneOf:
    - $ref: '#/types/backup_status'
    - $ref: '#/types/restore_status'
    - $ref: '#/types/factory_reset_status'
    properties:
      operation_type:
        description: Type of backup operation
        enum:
        - backup
        - restore
        - reset-factory
        type: string
      start_time:
        description: Timestamp of the start time
        type: integer
      status:
        $ref: '#/types/status'
      status_message:
        description: Status message
        type: string
    required:
    - operation_type
    - start_time
    - status
    - status_message
    type: object
  recurrence_rule:
    additionalProperties: false
    description: 'Recurrence rule specification for report schedule. Implements(incompletely)
      the Recurrence Rule Specification from iCalendar RFC - http://www.ietf.org/rfc/rfc2445.txt

      '
    properties:
      byday:
        description: Specifies days of the week.
        items:
          enum:
          - SU
          - MO
          - TU
          - WE
          - TH
          - FR
          - SA
          type: string
        type: array
      byhour:
        description: Specifies hours of the day.
        items:
          maximum: 23
          minimum: 0
          type: integer
        type: array
      byminute:
        description: Specifies minutes within an hour.
        items:
          minimum: 0
          type: integer
        type: array
      bymonth:
        description: Specifies array of the months of the year.
        items:
          maximum: 12
          minimum: 1
          type: integer
        type: array
      bymonthday:
        description: Specifies array of days of the month. 0 is invalid value.
        items:
          maximum: 31
          minimum: -31
          type: integer
        type: array
      bysecond:
        description: Specifies seconds within a minute.
        items:
          maximum: 59
          minimum: 0
          type: integer
        type: array
      bysetpos:
        description: 'Specifies the nth occurrence within the set of events specified
          by the rule. 0 is invalid value. It MUST only be used in conjunction with
          another BYxxx rule part.

          '
        items:
          maximum: 366
          minimum: -366
          type: integer
        type: array
      count:
        description: '# TODO enforce this in the schema Specifies the number of occurrences,
          either until or count must be specified, but not both.

          '
        minimum: 1
        type: integer
      dtstart:
        description: 'Specifies when the recurrence begins. High precision timestamp
          relative to the Unix Epoch.

          '
        type: integer
      freq:
        description: 'Type of recurrence rule, to specify repeating events based on
          an interval of freq.

          '
        enum:
        - YEARLY
        - QUARTERLY
        - MONTHLY
        - WEEKLY
        - DAILY
        - HOURLY
        - ONETIME
        type: string
      interval:
        description: Specifies how often the recurrence rule repeats.
        type: integer
      timezone:
        description: 'Specifies when the time zone. Example: Europe/Budapest. If not
          specified Etc/Universal is used.

          '
        type: string
      until:
        description: '# TODO enforce this in the schema Specifies when the recurrence
          ends, either until or count must be specified, but not both. High precision
          timestamp relative to the Unix Epoch.

          '
        type: string
    required:
    - freq
    type: object
  restore_status:
    additionalProperties: true
    description: Information about a restore
    properties:
      backup_id:
        description: Backup ID
        type: string
      operation_type:
        enum:
        - restore
        type: string
      server_name:
        description: Backup server (filer) name
        type: string
    required:
    - operation_type
    - server_name
    type: object
  status:
    description: Status description
    enum:
    - started
    - completed
    - failed
    - aborted
    type: string
version: '2.0'
