openapi: 3.0.3
info:
  title: Repository
  version: 1.0.0
  description: Repository APIs for managing the repositories in Cisco ISE, namely create, retrieve, update, validate and delete.
tags:
  - name: repository-api-controller
    description: the repository API
paths:
  /api/v1/repository:
    get:
      tags:
        - Repository
      summary: Get list of repositories
      description: 'This will get the full list of repository definitions on the system. '
      operationId: getRepositories
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoryListResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: >-
            Internal Server Error [Returned when retrieval of list of
            repositories configured failed]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BasicAuth: []
    post:
      tags:
        - Repository
      summary: Create a new repository
      description: >-
        Create a new repository in the system. The name provided for the
        repository must be unique. 
      operationId: createRepository
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Repository'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '201':
          description: Created
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '409':
          description: >-
            Conflict [Returned when attempting to create a repository
            configuration that already exists]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Internal Server Error [Returned when the creation of repository
            configuration failed]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BasicAuth: []
  /api/v1/repository/{repositoryName}:
    get:
      tags:
        - Repository
      summary: Get a specific repository
      description: 'Get a specific repository identified by the name passed in the URL. '
      operationId: getRepository
      parameters:
        - name: repositoryName
          in: path
          description: Unique name for a repository
          required: true
          style: simple
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoryResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: >-
            Not Found [Returned when the details of the requested repository is
            Not Found configured]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Internal Server Error [Returned when retrieval of requested
            repository failed]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BasicAuth: []
    put:
      tags:
        - Repository
      summary: Update the definition of a specific repository
      description: >-
        Update the definition of a specific repository, providing ALL parameters
        for the repository. 
      operationId: updateRepository
      parameters:
        - name: repositoryName
          in: path
          description: Unique name for a repository
          required: true
          style: simple
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Repository'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '201':
          description: Created
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '403':
          description: >-
            Forbidden [Updating a repository whose name does not match with the
            payload is Forbidden]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            Not Found [Returned when the repository requested for update is Not
            Found configured]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Internal Server Error [Returned when update on the requested
            repository failed]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BasicAuth: []
    delete:
      tags:
        - Repository
      summary: Delete a specific repository
      description: 'Long description TBD '
      operationId: deleteRepository
      parameters:
        - name: repositoryName
          in: path
          description: Unique name for a repository
          required: true
          style: simple
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: >-
            Not Found [Returned when the repository requested to delete is Not
            Found configured]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Internal Server Error [Returned when delete on the requested
            repository failed]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BasicAuth: []
  /api/v1/repository/{repositoryName}/files:
    get:
      tags:
        - Repository
      summary: Get list of files in a repository
      description: 'This will get the full list of files present in the named repository. '
      operationId: getRepositoryFiles
      parameters:
        - name: repositoryName
          in: path
          description: Unique name for a repository
          required: true
          style: simple
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoryFilenameListResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden [Listing of files from TFTP repository is Forbidden]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            Not Found [Returned when the repository requested to list the files
            from is Not Found configured]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Internal Server Error [Returned when the repository requested to
            list the files from failed]
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BasicAuth: []
components:
  schemas:
    CDROM:
      title: CDROM
      required:
        - name
        - path
        - protocol
      type: object
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /path/to/cdrom
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
    DISK:
      title: DISK
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
      allOf:
        - $ref: '#/components/schemas/Repository'
        - title: DISK
          required:
            - name
            - path
            - protocol
          type: object
          properties:
            name:
              type: string
              description: >-
                Repository name should be less than 80 characters and can
                contain alphanumeric, underscore, hyphen and dot characters.
              example: repo_name
            path:
              type: string
              description: >-
                Path should always start with "/" and can contain alphanumeric,
                underscore, hyphen and dot characters.
              example: /
            protocol:
              type: string
              enum:
                - CDROM
                - DISK
                - FTP
                - HTTP
                - HTTPS
                - NFS
                - SFTP
                - TFTP
    ErrorResponse:
      title: ErrorResponse
      type: object
      properties:
        error:
          $ref: '#/components/schemas/Message'
        version:
          type: string
          example: 1.0.0
    FTP:
      title: FTP
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        password:
          type: string
          description: Password can contain alphanumeric and/or special characters.
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /path/to/ftp
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
        serverName:
          type: string
        userName:
          type: string
          description: Username may contain alphanumeric and _-./@\\$ characters.
      allOf:
        - $ref: '#/components/schemas/Repository'
        - title: FTP
          required:
            - name
            - password
            - path
            - protocol
            - serverName
            - userName
          type: object
          properties:
            name:
              type: string
              description: >-
                Repository name should be less than 80 characters and can
                contain alphanumeric, underscore, hyphen and dot characters.
              example: repo_name
            password:
              type: string
              description: Password can contain alphanumeric and/or special characters.
            path:
              type: string
              description: >-
                Path should always start with "/" and can contain alphanumeric,
                underscore, hyphen and dot characters.
              example: /path/to/ftp
            protocol:
              type: string
              enum:
                - CDROM
                - DISK
                - FTP
                - HTTP
                - HTTPS
                - NFS
                - SFTP
                - TFTP
            serverName:
              type: string
            userName:
              type: string
              description: Username may contain alphanumeric and _-./@\\$ characters.
    HTTP:
      title: HTTP
      required:
        - name
        - path
        - protocol
        - serverName
      type: object
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /path/to/http
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
        serverName:
          type: string
    HTTPS:
      title: HTTPS
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /path/to/https
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
        serverName:
          type: string
      allOf:
        - $ref: '#/components/schemas/Repository'
        - title: HTTPS
          required:
            - name
            - path
            - protocol
            - serverName
          type: object
          properties:
            name:
              type: string
              description: >-
                Repository name should be less than 80 characters and can
                contain alphanumeric, underscore, hyphen and dot characters.
              example: repo_name
            path:
              type: string
              description: >-
                Path should always start with "/" and can contain alphanumeric,
                underscore, hyphen and dot characters.
              example: /path/to/https
            protocol:
              type: string
              enum:
                - CDROM
                - DISK
                - FTP
                - HTTP
                - HTTPS
                - NFS
                - SFTP
                - TFTP
            serverName:
              type: string
    Message:
      title: Message
      type: object
      properties:
        message:
          type: string
          example: 1.0.0
    NFS:
      title: NFS
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /path/to/nfs
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
        serverName:
          type: string
      allOf:
        - $ref: '#/components/schemas/Repository'
        - title: NFS
          required:
            - name
            - path
            - protocol
            - serverName
          type: object
          properties:
            name:
              type: string
              description: >-
                Repository name should be less than 80 characters and can
                contain alphanumeric, underscore, hyphen and dot characters.
              example: repo_name
            path:
              type: string
              description: >-
                Path should always start with "/" and can contain alphanumeric,
                underscore, hyphen and dot characters.
              example: /path/to/nfs
            protocol:
              type: string
              enum:
                - CDROM
                - DISK
                - FTP
                - HTTP
                - HTTPS
                - NFS
                - SFTP
                - TFTP
            serverName:
              type: string
    Repository:
      title: Repository
      required:
        - name
        - protocol
      type: object
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
    RepositoryFilenameListResponse:
      title: RepositoryFilenameListResponse
      type: object
      properties:
        response:
          type: array
          items:
            type: string
        version:
          type: string
          example: 1.0.0
    RepositoryListResponse:
      title: RepositoryListResponse
      type: object
      properties:
        response:
          type: array
          items:
            $ref: '#/components/schemas/Repository'
        version:
          type: string
          example: 1.0.0
    RepositoryResponse:
      title: RepositoryResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/Repository'
        version:
          type: string
          example: 1.0.0
    SFTP:
      title: SFTP
      required:
        - enablePki
        - name
        - path
        - protocol
        - serverName
        - userName
      type: object
      properties:
        enablePki:
          type: boolean
          example: false
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        password:
          type: string
          description: Password can contain alphanumeric and/or special characters.
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /path/to/sftp
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
        serverName:
          type: string
        userName:
          type: string
          description: Username may contain alphanumeric and _-./@\\$ characters.
      description: >-
        The SFTP repository type can either use username/password authentication
        **or** PKI-based authentication. Thus an SFTP repository, when created,
        must have either enablePki set **or** have both the user name and the
        password. 
    SuccessResponse:
      title: SuccessResponse
      type: object
      properties:
        success:
          $ref: '#/components/schemas/Message'
        version:
          type: string
          example: 1.0.0
    TFTP:
      title: TFTP
      required:
        - name
        - path
        - protocol
        - serverName
      type: object
      properties:
        name:
          type: string
          description: >-
            Repository name should be less than 80 characters and can contain
            alphanumeric, underscore, hyphen and dot characters.
          example: repo_name
        path:
          type: string
          description: >-
            Path should always start with "/" and can contain alphanumeric,
            underscore, hyphen and dot characters.
          example: /path/to/tftp
        protocol:
          type: string
          enum:
            - CDROM
            - DISK
            - FTP
            - HTTP
            - HTTPS
            - NFS
            - SFTP
            - TFTP
        serverName:
          type: string
