get:
  operationId: listSources
  security:
    - oauth2: [ idn:sources:read ]
  tags:
    - Sources
  summary: Lists all sources in IdentityNow.
  description: >-
    This end-point lists all the sources in IdentityNow.

    A token with ORG_ADMIN, SOURCE_ADMIN, SOURCE_SUBADMIN, or ROLE_SUBADMIN authority is required to call this API.
  parameters:
    - $ref: '../../v3/parameters/limit.yaml'
    - $ref: '../../v3/parameters/offset.yaml'
    - $ref: '../../v3/parameters/count.yaml'
    - in: query
      name: filters
      schema:
        type: string
      example: name eq "#Employees"
      description: >-
        Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results)

        Filtering is supported for the following fields and operators:
          **id**: *eq, in*
          **name**: *co, eq, in, sw*
          **type**: *eq, in*
          **owner.id**: *eq, in*
          **features**: *ca, co*
          **created**: *eq*
          **modified**: *eq*
          **managementWorkgroup.id**: *eq*
          **description**: *eq*
          **authoritative**: *eq*
          **healthy**: *eq*
          **status**: *eq, in*
          **connectionType**: *eq*
          **connectorName**: *eq*
    - in: query
      name: sorters
      schema:
        type: string
        format: comma-separated
      example: name
      description: >-
        Sort results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#sorting-results)


        Sorting is supported for the following fields: **type, created, modified, name, owner.name, healthy, status**
    - in: query
      name: for-subadmin
      schema:
        type: string
      example: name
      description: >-
        Filter the returned list of sources for the identity specified by the parameter, which is the id of an identity
        with the role SOURCE_SUBADMIN. By convention, the value **me** indicates the identity id of the current user.

        Subadmins may only view Sources which they are able to administer; all other Sources will be filtered out when
        this parameter is set. If the current user is a SOURCE_SUBADMIN but fails to pass a valid value for this
        parameter, a 403 Forbidden is returned.
  responses:
    '200':
      description: List of Source objects
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '../schemas/Source.yaml'
    '400':
      $ref: '../../v3/responses/400.yaml'
    '401':
      $ref: '../../v3/responses/401.yaml'
    '403':
      $ref: '../../v3/responses/403.yaml'
    '404':
      $ref: '../../v3/responses/404.yaml'
    '429':
      $ref: '../../v3/responses/429.yaml'
    '500':
      $ref: '../../v3/responses/500.yaml'
post:
  operationId: createSource
  security:
    - oauth2: [ idn:sources:manage ]
  tags:
    - Sources
  summary: Creates a source in IdentityNow.
  description: >-
    This creates a specific source with a full source JSON representation. Any passwords are submitted as plain-text and
    encrypted upon receipt in IdentityNow.

    A token with ORG_ADMIN, SOURCE_ADMIN, or SOURCE_SUBADMIN authority is required to call this API.
  parameters:
    - in: query
      name: provisionAsCsv
      description: >-
        If this parameter is `true`, it configures the source as a Delimited File (CSV) source. Setting this to `true` will automatically set the `type` of the source to `DelimitedFile`. 
        You must use this query parameter to create a Delimited File source as you would in the UI. 
        If you don't set this query parameter and you attempt to set the `type` attribute directly, the request won't correctly generate the source.  
      schema:
        type: boolean
      required: false
      example: false
  requestBody:
    required: true
    content:
      application/json:
        schema:
          $ref: '../schemas/Source.yaml'
  responses:
    '201':
      description: >-
        Created Source object. Any passwords will only show the the encrypted cipher-text, as they are not decrypt-able
        in IdentityNow cloud-based services, per IdentityNow security design.
      content:
        application/json:
          schema:
            $ref: '../schemas/Source.yaml'
    '400':
      $ref: '../../v3/responses/400.yaml'
    '401':
      $ref: '../../v3/responses/401.yaml'
    '403':
      $ref: '../../v3/responses/403.yaml'
    '429':
      $ref: '../../v3/responses/429.yaml'
    '500':
      $ref: '../../v3/responses/500.yaml'
