openapi: 3.0.3
info:
  title: Backup and Restore
  version: 1.0.0
  description: Configuration Backup and Restore APIs for managing the configuration DB Backup and Restore functionality. Schedule configuration DB backup, cancel running backup and last backup status APIs are also available.
tags:
  - name: backup-restore-api-controller
    description: the backup-restore API
paths:
  /api/v1/backup-restore/config/backup:
    post:
      tags:
        - Backup And Restore
      summary: >-
        Take the config DB backup now by providing the name of the
        backup,repository name and encryption key. The API returns the task ID.
        Use the Task Service status API to get the status of the backup job
      description: >-
        Triggers on demand configuration backup on the ISE node. The API returns
        the task ID. Use the Task Service status API to get the status of the
        backup job.
      operationId: configBackup
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigBackup'
      responses:
        '200':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '201':
          description: Created
        '202':
          description: >-
            Config DB backup task initiated. Please use Task Service status API
            to get the status of the backup job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackupRestoreTaskResponse'
        '400':
          description: Invalid Input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
      security:
        - BasicAuth: []
  /api/v1/backup-restore/config/cancel-backup:
    post:
      tags:
        - Backup And Restore
      summary: Cancel the running backup
      description: Cancels the backup job running on the node.
      operationId: cancelBackup
      responses:
        '200':
          description: The config backup job got canceled successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelBackupResponse'
        '201':
          description: Created
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '405':
          description: Cancel operation not executed as there are no backup running
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationNotExecuted'
      security:
        - BasicAuth: []
  /api/v1/backup-restore/config/last-backup-status:
    get:
      tags:
        - Backup And Restore
      summary: Gives the last backup status
      description: Gives the last backup status
      operationId: getLastConfigBackupStatus
      responses:
        '200':
          description: Provides the status of last backup.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigBackupStatusResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
      security:
        - BasicAuth: []
  /api/v1/backup-restore/config/restore:
    post:
      tags:
        - Backup And Restore
      summary: >-
        Restore a config DB backup by giving the name of the backup file,
        repository name and encryption key. The API returns the task ID. Use the
        Task Service status API to get the status of the restore job
      description: >-
        Triggers a configuration DB restore job on the ISE node. The API returns
        the task ID. Use the Task Service status API to get the status of the
        backup job
      operationId: restoreConfigBackup
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigRestore'
      responses:
        '200':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '201':
          description: Created
        '202':
          description: >-
            Config DB restore task initiated. Please use Task Service status API
            to get the status of the restore job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackupRestoreTaskResponse'
        '400':
          description: Invalid Input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
      security:
        - BasicAuth: []
  /api/v1/backup-restore/config/schedule-config-backup:
    put:
      tags:
        - Backup And Restore
      summary: Update scheduled configuration backup
      description: >-
        Update the Schedule of the configuration backup on the ISE node as per
        the input parameters. This API only helps in editing the schedule.
      operationId: updateScheduledConfigBackup
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleConfigBackupRequest'
      responses:
        '200':
          description: The config backup job got scheduled successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigScheduleStatusResponse'
        '201':
          description: Created
        '400':
          description: Invalid Input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '405':
          description: >-
            PUT method is used for editing the schedule. Please use POST method
            for creating the schedule for the first time.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationNotExecuted'
      security:
        - BasicAuth: []
    post:
      tags:
        - Backup And Restore
      summary: >-
        Schedules the configuration backup on the ISE node as per the input
        parameters.
      description: >-
        Schedules the configuration backup on the ISE node as per the input
        parameters. This API helps in creating the schedule for the first time.
      operationId: createScheduledConfigBackup
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleConfigBackupRequest'
      responses:
        '200':
          description: The config backup job got scheduled successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigScheduleStatusResponse'
        '201':
          description: Created
        '400':
          description: Invalid Input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '405':
          description: POST method is used to create the schedule for the first time.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationNotExecuted'
      security:
        - BasicAuth: []
components:
  schemas:
    BackupRestoreTask:
      title: BackupRestoreTask
      type: object
      properties:
        id:
          type: string
          description: >-
            Id which can be used to track the status of backup / restore of
            config DB.
          example: a1714b90-be06-11eb-bf27-c208c4aa1432
        message:
          type: string
          example: >-
            Config DB backup task initiated. Please use Task Service status API
            to get the status of the backup job
    BackupRestoreTaskResponse:
      title: BackupRestoreTaskResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/BackupRestoreTask'
        version:
          type: string
          example: 1.0.0
    CancelBackupResponse:
      title: CancelBackupResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/ConfigBackupStatus'
        version:
          type: string
          example: 1.0.0
    ConfigBackup:
      title: ConfigBackup
      required:
        - backupEncryptionKey
        - backupName
        - repositoryName
      type: object
      properties:
        backupEncryptionKey:
          type: string
          description: >-
            The encyption key for the backed up file. Encryption key must
            satisfy the following criteria - Contains at least one uppercase
            letter [A-Z], Contains at least one lowercase letter [a-z], Contains
            at least one digit [0-9], Contain only [A-Z][a-z][0-9]_#, Has at
            least 8 characters, Has not more than 15 characters, Must not
            contain 'CcIiSsCco', Must not begin with
          example: Qwerty123
        backupName:
          type: string
          description: The backup file will get saved with this name.
          example: backup_name
        repositoryName:
          type: string
          description: >-
            Name of the configured repository where the generated backup file
            will get copied.
          example: repo_name
    ConfigBackupStatus:
      title: ConfigBackupStatus
      type: object
      properties:
        action:
          type: string
          enum:
            - BACKUP
            - CANCEL
            - RESTORE
        details:
          type: string
          description: Details of the job
          example: Starting Backup
        error:
          type: string
          description: Error message. False in case of no error
          example: 'false'
        hostName:
          type: string
          description: Hostname where the job has executed
          example: ise-120.cisco.com
        initiatedFrom:
          type: string
          enum:
            - ADMIN_GUI
            - CLI
            - OPEN_API
        justComplete:
          type: string
          description: Whether the job completed now. Possible values - Yes, No
          example: 'true'
        message:
          type: string
          description: detail message in case of exception
          example: >-
            Backup Failed Cancelled by user / Backup Failed Copy to repository
            failed
        name:
          type: string
          description: Backup name given at the time of scheduling the job.
          example: backup_name
        percentComplete:
          type: string
          description: >-
            shows the percent completion of the job. Possible value range  1 -
            100
          example: '20'
        repository:
          type: string
          description: configured repository selected for the backup / restore job
          example: repo_name
        scheduled:
          type: string
          description: >-
            last action performed with respect to backup job. Possible values-
            BACKUP , CANCEL
          example: BACKUP
        startDate:
          type: string
          description: Start date of the backup job
          example: Wed May 26 15:12:06 IST 2021
        status:
          type: string
          enum:
            - COMPLETED
            - ERROR
            - IN_PROGRESS
        type:
          type: string
          enum:
            - CONFIGURATION_DB
            - OPERATIONAL_DB
    ConfigBackupStatusResponse:
      title: ConfigBackupStatusResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/ConfigBackupStatus'
        version:
          type: string
          example: 1.0.0
    ConfigRestore:
      title: ConfigRestore
      required:
        - backupEncryptionKey
        - repositoryName
        - restoreFile
        - restoreIncludeAdeos
      type: object
      properties:
        backupEncryptionKey:
          type: string
          description: The encryption key which was provided at the time of taking backup.
          example: Qwerty123
        repositoryName:
          type: string
          description: Name of the configred repository where the backup file exists.
          example: repo_name
        restoreFile:
          type: string
          description: Name of the backup file to be restored on ISE node.
          example: ISECONFIG-CFG10-210514-1755.tar.gpg
        restoreIncludeAdeos:
          type: string
          description: >-
            Determines whether the ADE-OS configure is restored. Possible values
            true, false
          example: 'true'
    ConfigScheduleStatus:
      title: ConfigScheduleStatus
      type: object
      properties:
        message:
          type: string
          description: Response message on successful scheduling the backup job.
          example: The config backup job got scheduled successfully
    ConfigScheduleStatusResponse:
      title: ConfigScheduleStatusResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/ConfigScheduleStatus'
        version:
          type: string
          example: 1.0.0
    Error:
      title: Error
      required:
        - code
        - message
      type: object
      properties:
        code:
          type: integer
          format: int32
          example: 400
        message:
          type: string
          example: Invalid repository name
    OperationNotExecuted:
      title: OperationNotExecuted
      required:
        - code
        - message
      type: object
      properties:
        code:
          type: integer
          format: int32
          example: 405
        message:
          type: string
          example: Cancel can't be executed as there is no running backup.
    ScheduleConfigBackupRequest:
      title: ScheduleConfigBackupRequest
      required:
        - backupEncryptionKey
        - backupName
        - frequency
        - repositoryName
        - startDate
        - time
      type: object
      properties:
        backupDescription:
          type: string
          description: Description of the backup.
          example: backup description like configuration backup daily
        backupEncryptionKey:
          type: string
          description: >-
            The encyption key for the backed up file. Encryption key must
            satisfy the following criteria - Contains at least one uppercase
            letter [A-Z], Contains at least one lowercase letter [a-z], Contains
            at least one digit [0-9], Contain only [A-Z][a-z][0-9]_#, Has at
            least 8 characters, Has not more than 15 characters, Must not
            contain 'CcIiSsCco', Must not begin with
          example: Qwerty123
        backupName:
          type: string
          description: The backup file will get saved with this name.
          example: backup_name
        endDate:
          type: string
          description: >-
            End date of the scheduled backup job. Allowed format MM/DD/YYYY. End
            date is not required in case of ONE_TIME frequency.
          example: 05/13/2021
        frequency:
          type: string
          enum:
            - DAILY
            - MONTHLY
            - ONCE
            - WEEKLY
        monthDay:
          type: string
          description: >-
            Day of month you want backup to be performed on when scheduled
            frequency is MONTHLY. Allowed values - from 1 to 28.
          example: '5'
        repositoryName:
          type: string
          description: >-
            Name of the configured repository where the generated backup file
            will get copied.
          example: repo_name
        startDate:
          type: string
          description: Start date for scheduling the backup job. Allowed format MM/DD/YYYY.
          example: 05/13/2021
        status:
          type: string
          enum:
            - DISABLE
            - ENABLE
        time:
          type: string
          description: Time at which backup job get scheduled. example- 12:00 AM
          example: 09:30 PM
        weekDay:
          type: string
          enum:
            - FRI
            - MON
            - SAT
            - SUN
            - THU
            - TUE
            - WED
