openapi: 3.0.0
info:
  title: IP Source
  description: This document provides that provides the API documentation for managing conditional factor configurations for IP sources in ManageEngine ID360.
  version: 1.0.0
servers:
  - url: 'https://id360.manageengine.com/api/v1'
    description: 'API Endpoint'
tags:
  - name: cfc-ipsource
    description: Conditional Factor Configurations for IP Sources
paths:
  /protection/conditionalfactor-configs/ipsources:
    get:
      tags:
        - cfc-ipsource
      summary: List IP Sources
      description: List all conditional factor configurations for IP sources.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/fields'
        - $ref: '#/components/parameters/from'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ipSources'
                  meta:
                    $ref: '#/components/schemas/meta'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_factor_config.read
            - id360.conditional_factor_config.all
    post:
      tags:
        - cfc-ipsource
      summary: Create IP Source
      description: Create a conditional factor configuration for IP sources.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ipSource'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipSource'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_factor_config.create
            - id360.conditional_factor_config.all
    delete:
      tags:
        - cfc-ipsource
      summary: Bulk delete IP Sources
      description: Bulk delete conditional factor configurations for IP sources.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/ids'
      responses:
        '204':
          description: No Content
        '207':
          description: 'Multi-Status'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/bulkActionsMultiStatus'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_factor_config.delete
            - id360.conditional_factor_config.all

  /protection/conditionalfactor-configs/ipsources/{id}:
    get:
      tags:
        - cfc-ipsource
      summary: Get IP Source by ID
      description: Retrieve a conditional factor configuration for IP sources by its ID.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipSource'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '404':
          description: 'Not Found'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipSourceNotFound'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_factor_config.read
            - id360.conditional_factor_config.all
    patch:
      tags:
        - cfc-ipsource
      summary: Update IP Source by ID
      description: Update a conditional factor configuration for IP sources by its ID.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ipSource'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipSource'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '404':
          description: 'Not Found'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipSourceNotFound'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_factor_config.update
            - id360.conditional_factor_config.all
    delete:
      tags:
        - cfc-ipsource
      summary: Delete IP Source by ID
      description: Delete a conditional factor configuration for IP sources by its ID.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: No Content
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '404':
          description: 'Not Found'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipSourceNotFound'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_factor_config.delete
            - id360.conditional_factor_config.all

  /protection/conditionalfactor-configs/ipsources/{id}/conditional-access-policies:
    get:
      tags:
        - cfc-ipsource
      summary: List Conditional Access Policies for a Specific IP Source
      description: List all conditional access policies associated with a specific conditional factor configuration for IP sources.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/from'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/conditionalAccessPolicyPartialResources'
                  meta:
                    $ref: '#/components/schemas/meta'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '404':
          description: 'Not Found'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipSourceNotFound'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.conditional_factor_config.read
            - id360.conditional_factor_config.all
components:
  parameters:
    acceptHeader:
      name: Accept
      in: header
      schema:
        type: string
      description: 'Accept header for the API'
      required: false
      example: 'application/json'
    fields:
      in: query
      name: fields
      schema:
        type: string
      description: >
        Comma-separated list of fields to include in the response.
        <br>
        <strong>eg:</strong> id,name,description,is_enabled,assignment,access_type,endpoint_settings,advanced_settings
      required: false
      example: id,name,description,is_enabled,assignment,access_type,endpoint_settings,advanced_settings
    from:
      in: query
      name: from
      schema:
        type: integer
        default: 1
      description: >
        Start index for pagination.
      required: false
      example:  1
    limit:
      in: query
      name: limit
      schema:
        type: integer
        maximum: 100
        minimum: 1
        default: 25
      description: >
        Maximum number of records to return in the response.
        <br>
        <strong>eg:</strong> 50
      required: false
      example: 50
    filter:
      in: query
      name: filter
      schema:
        type: string
      description: >
        Filter users based on a the provided SCIM filter query. Refer to filter section for more details
        <br>
        <strong>eg:</strong> name eq "Policy 01"
      required: false
      example: name eq "Policy 01"
    id:
      in: path
      name: id
      required: true
      description: The ID of the conditional access policy.
      example: 2000000000001
      schema:
        type: integer
    ids:
      name: ids
      in: query
      required: true
      description: 'Comma-separated list of IDs to be deleted'
      example: '2000000000001,2000000000002'
      schema:
        type: string
        example: '2000000000001,2000000000002'
  schemas:
    gendoc-attributes-schema:
      type: object
      $ref: '#/components/schemas/ipSource'

    ipSources:
      type: array
      items:
        $ref: '#/components/schemas/ipSource'
      example:
        - id: '20000000001'
          display_name: 'Corp Network'
          ca_policies_usage_count: 5
          last_modified_time: '2023-10-01T12:00:00Z'
          is_trusted_source: true
          ip_addresses: '10.0.0.1,10.0.0.2,10.0.0.3'
          ip_address_ranges:
            - from: '10.0.0.1'
              to: '10.0.0.200'
        - id: '20000000002'
          display_name: 'Remote Office'
          ca_policies_usage_count: 3
          last_modified_time: '2023-10-01T12:00:00Z'
          is_trusted_source: false
          ip_addresses: '110.0.0.1,110.0.0.2,110.0.0.3'
          ip_address_ranges:
            - from: '110.0.0.1'
              to: '110.0.0.200'
    ipSource:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the conditional factor configuration.
          example: '20000000001'
          readOnly: true
        display_name:
          type: string
          description: Display name for the conditional factor configuration.
          example: 'Corp Network'
        ca_policies_usage_count:
          type: integer
          description: Number of conditional access policies using this factor.
          example: 5
          readOnly: true
        last_modified_time:
          type: string
          format: date-time
          description: Last modified time of the configuration.
          example: '2023-10-01T12:00:00Z'
          readOnly: true
        is_trusted_source:
          type: boolean
          description: Indicates if the source is trusted.
          example: true
        ip_addresses:
          type: string
          description: Comma-separated list of IP addresses.
          example: '10.0.0.1,10.0.0.2,10.0.0.3'
        ip_address_ranges:
          type: array
          items:
            type: object
            properties:
              from:
                type: string
                description: Start of the IP address range.
                example: '10.0.0.1'
              to:
                type: string
                description: End of the IP address range.
                example: '10.0.0.200'
    ipSourceNotFound:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '*****'
            title:
              type: string
              example: 'Conditional Factor Config Not Found'
            detail:
              type: string
              example: 'The conditional factor configuration with the specified ID does not exist.'

    conditionalAccessPolicyPartialResources:
      type: array
      items:
        $ref: '#/components/schemas/conditionalAccessPolicyPartialResource'
      example:
        - id: '2000000000001'
          name: 'Policy 01'
          associated_endpoints:
            - 'Computer Devices'
            - 'VPN & Radius Endpoints'
        - id: '2000000000002'
          name: 'Policy 02'
          associated_endpoints:
            - All Endpoints
        - id: '2000000000003'
          name: 'Policy 03'
          associated_endpoints:
            - 'Computer Devices'
    conditionalAccessPolicyPartialResource:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the conditional access policy.
          example: '2000000000001'
          readOnly: true
        name:
          type: string
          description: Name of the conditional access policy.
          example: 'Policy 01'
        associated_endpoints:
          type: array
          items:
            type: string
          description: List of endpoints associated with the conditional access policy.
          example:
            - 'Computer Devices'
            - 'VPN & Radius Endpoints'

    meta:
      type: object
      properties:
        start_index:
          type: integer
          description: The starting index of the records in the response.
          example: 1
        limit:
          type: integer
          description: The maximum number of records returned in the response.
          example: 100
        total_no_of_objects:
          type: integer
          description: The total number of records available for the request.
          example: 3

    bulkActionsMultiStatus:
      type: array
      items:
        type: object
        properties:
          resource_id:
            type: string
            description: The ID of the user for whom the action was performed.
            example: '2000000000001'
          status:
            type: integer
            description: HTTP status code indicating the result of the action.
            example: 204
          error:
            $ref: '#/components/schemas/ipSourceNotFound'
      example:
        - resource_id: '2000000000001'
          status: 204
        - resource_id: '2000000000002'
          status: 404
          error:
            code: '*****'
            title: 'Conditional Factor Config Not Found'
            detail: 'The conditional factor configuration with the specified ID does not exist.'
    unauthorized:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000101'
            title:
              type: string
              example: 'Unauthorized'
            detail:
              type: string
              example: 'The OAuth token is invalid.'
    serverError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000000'
            title:
              type: string
              example: 'Internal Server Error'
            detail:
              type: string
              example: 'An unexpected internal error has occurred on the server. Please try again later.'
  securitySchemes:
    Zoho_Auth:
      type: oauth2
      x-authorization-example: 'Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f'
      flows:
        authorizationCode:
          authorizationUrl: 'https://accounts.zoho.com/oauth/v2/auth'
          tokenUrl: 'https://accounts.zoho.com/oauth/v2/token'
          scopes:
            id360.conditional_factor_config.read: 'Read access for management actions'
            id360.conditional_factor_config.write: 'Write access for management actions'
            id360.conditional_factor_config.create: 'Create access for management actions'
            id360.conditional_factor_config.delete: 'Delete access for management actions'
            id360.conditional_factor_config.update: 'Update access for management actions'
            id360.conditional_factor_config.all: 'All access for management actions'