openapi: 3.1.0
info:
  title: access-mapper
  contact: {}
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  version: "1.0"
servers:
- url: http://localhost:49643
  description: Generated server url
tags:
- name: Access Group
  description: Access Group resources
- name: Access configuration
  description: Access configuration resources
paths:
  /{municipalityId}/{namespace}/access-config/group/{groupId}:
    get:
      tags:
      - Access Group
      operationId: getAccessGroup
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: namespace
        in: path
        description: Namespace
        required: true
        schema:
          type: string
          pattern: "[\\w|\\-]+"
        example: MY_NAMESPACE
      - name: groupId
        in: path
        description: Group ID
        required: true
        schema:
          type: string
          minLength: 1
        example: group123
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccessGroup"
        "404":
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    put:
      tags:
      - Access Group
      operationId: updateAccessGroup
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: namespace
        in: path
        description: Namespace
        required: true
        schema:
          type: string
          pattern: "[\\w|\\-]+"
        example: MY_NAMESPACE
      - name: groupId
        in: path
        description: Group ID
        required: true
        schema:
          type: string
          minLength: 1
        example: group123
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AccessGroup"
        required: true
      responses:
        "204":
          description: No content - Successful operation
        "404":
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    post:
      tags:
      - Access Group
      operationId: createAccessGroup
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: namespace
        in: path
        description: Namespace
        required: true
        schema:
          type: string
          pattern: "[\\w|\\-]+"
        example: MY_NAMESPACE
      - name: groupId
        in: path
        description: Group ID
        required: true
        schema:
          type: string
          minLength: 1
        example: group123
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AccessGroup"
        required: true
      responses:
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "201":
          description: Successfully created
          content:
            '*/*':
              schema:
                $ref: "#/components/schemas/AccessGroup"
    delete:
      tags:
      - Access Group
      operationId: deleteAccessGroup
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: namespace
        in: path
        description: Namespace
        required: true
        schema:
          type: string
          pattern: "[\\w|\\-]+"
        example: MY_NAMESPACE
      - name: groupId
        in: path
        description: Group ID
        required: true
        schema:
          type: string
          minLength: 1
        example: group123
      responses:
        "204":
          description: No content - Successful operation
        "404":
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/{namespace}/access/ad/{adId}:
    get:
      tags:
      - Access configuration
      operationId: getAccessDetails
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: namespace
        in: path
        description: Namespace
        required: true
        schema:
          type: string
          pattern: "[\\w|\\-]+"
        example: MY_NAMESPACE
      - name: adId
        in: path
        description: AdId for the user to get details about
        required: true
        schema:
          type: string
        example: joe01doe
      - name: type
        in: query
        description: Filter type
        required: false
        schema:
          type: string
        example: label
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AccessGroup"
        "404":
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/{namespace}/access-config/group:
    get:
      tags:
      - Access Group
      operationId: getAccessGroups
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: namespace
        in: path
        description: Namespace
        required: true
        schema:
          type: string
          pattern: "[\\w|\\-]+"
        example: MY_NAMESPACE
      - name: type
        in: query
        description: Filter type
        required: false
        schema:
          type: string
        example: label
      responses:
        "400":
          description: Bad request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AccessGroup"
  /api-docs:
    get:
      tags:
      - API
      summary: OpenAPI
      operationId: getApiDocs
      responses:
        "200":
          description: OK
          content:
            application/yaml:
              schema:
                type: string
      x-auth-type: None
      x-throttling-tier: Unlimited
      x-wso2-mutual-ssl: Optional
components:
  schemas:
    Access:
      type: object
      description: Access model
      properties:
        pattern:
          type: string
          description: Access pattern
          examples:
          - FA/**
        accessLevel:
          type: string
          description: Access level
          enum:
          - RW
          - R
          - LR
          examples:
          - LR
    AccessGroup:
      type: object
      description: Access group model
      properties:
        group:
          type: string
          description: Access group
          examples:
          - G1
        accessByType:
          type: array
          description: Access by type
          items:
            $ref: "#/components/schemas/AccessType"
    AccessType:
      type: object
      description: Access type model
      properties:
        type:
          type: string
          description: Access type
          examples:
          - label
        access:
          type: array
          description: Access by type
          items:
            $ref: "#/components/schemas/Access"
    Problem:
      type: object
      properties:
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
          format: uri
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
    ConstraintViolationProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
        violations:
          type: array
          items:
            $ref: "#/components/schemas/Violation"
        title:
          type: string
        causeAsProblem:
          $ref: "#/components/schemas/ThrowableProblem"
        detail:
          type: string
        instance:
          type: string
          format: uri
    ThrowableProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
          format: int32
        detail:
          type: string
        instance:
          type: string
          format: uri
        causeAsProblem: {}
    Violation:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
  securitySchemes: {}
