openapi: 3.0.3
info:
  title: HAL API Service
  description: |
    # The HAL API services provides the following features
    - Gets organization account information
    - Gets payer and unit information per acccount
    ### Release Notes
    v1.0.4
    - More CDK and OpenAPI improvements.
    v1.0.3
    - CDK and OpenAPI improvements.
    v1.0.2
    - Cleanup and internal version release testing
    v1.0.1
    - Version testing
    v1.0.0
    - Initial API doc release
  version: 1.0.4
  contact:
    email: io-hal-support@pearson.com
  license:
    name: Pearson Proprietary
    url: 'https://pearsoneducationinc.sharepoint.com/sites/GRPTechOpsPearsonCloudServices/_layouts/15/stream.aspx?id=%2Fsites%2FGRPTechOpsPearsonCloudServices%2FShared%20Documents%2FPCM%20Portal%2FHAL%20Widget%20Tutorial%2Emp4'
servers:
  - url: 'https://api.pearsoncloudmanagement.com/hal'
    description: Production HAL API
  - url: 'https://api-dev.pearsoncloudmanagement.com/hal'
    description: Development HAL API
  - url: 'https://localhost:3000'
    description: Development HAL API
tags:
  - name: accounts
    description: Information about accounts and organizations
    externalDocs:
      description: Accounts Documentation
      url: 'https://pearsoneducationinc.sharepoint.com/sites/GRPTechOpsPearsonCloudServices/_layouts/15/stream.aspx?id=%2Fsites%2FGRPTechOpsPearsonCloudServices%2FShared%20Documents%2FPCM%20Portal%2FHAL%20Widget%20Tutorial%2Emp4'
  - name: payers
    description: Information about payers for accounts and organizations
    externalDocs:
      description: Payers Documentation
      url: 'https://pearsoneducationinc.sharepoint.com/sites/GRPTechOpsPearsonCloudServices/_layouts/15/stream.aspx?id=%2Fsites%2FGRPTechOpsPearsonCloudServices%2FShared%20Documents%2FPCM%20Portal%2FHAL%20Widget%20Tutorial%2Emp4'
paths:
  /payeraccountorgdetails:
    get:
      tags:
        - payers
      summary: Find payers
      description: |
        Find payers for a given account
      operationId: findPayers
      responses:
        '200':
          description: successful operation
          headers:
            Content-Type:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Headers:
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Definition for the payer-org-units-and-policies json
                additionalProperties:
                  type: object
                  additionalProperties:
                    type: object
                    required:
                      - name
                      - AISERVICES_OPT_OUT_POLICY
                      - BACKUP_POLICY
                      - SERVICE_CONTROL_POLICY
                      - TAG_POLICY
                      - accounts
                    properties:
                      name:
                        type: string
                        example:
                          - Root
                          - Root/CloudEndureDR/Recovery
                      AISERVICES_OPT_OUT_POLICY:
                        type: array
                        items:
                          description: List of policies
                          type: object
                          minItems: 0
                          uniqueItems: true
                          required:
                            - Id
                            - Arn
                            - Name
                            - Type
                            - AwsManaged
                          properties:
                            Id:
                              type: string
                              example:
                                - p-FullAWSAccess
                                - p-v7joeyus
                            Arn:
                              type: string
                              example:
                                arn1:
                                  value: 'arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess'
                                arn2:
                                  value: 'arn:aws:organizations::150047381276:policy/o-njq6j1wsrz/service_control_policy/p-v7joeyus'
                            Name:
                              type: string
                              example:
                                - FullAWSAccess
                                - PreventAccessToDummy
                            Type:
                              type: string
                              enum:
                                - AISERVICES_OPT_OUT_POLICY
                                - BACKUP_POLICY
                                - SERVICE_CONTROL_POLICY
                                - TAG_POLICY
                            AwsManaged:
                              type: boolean
                      BACKUP_POLICY:
                        type: array
                        items:
                          description: List of policies
                          type: object
                          minItems: 0
                          uniqueItems: true
                          required:
                            - Id
                            - Arn
                            - Name
                            - Type
                            - AwsManaged
                          properties:
                            Id:
                              type: string
                              example:
                                - p-FullAWSAccess
                                - p-v7joeyus
                            Arn:
                              type: string
                              example:
                                arn1:
                                  value: 'arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess'
                                arn2:
                                  value: 'arn:aws:organizations::150047381276:policy/o-njq6j1wsrz/service_control_policy/p-v7joeyus'
                            Name:
                              type: string
                              example:
                                - FullAWSAccess
                                - PreventAccessToDummy
                            Type:
                              type: string
                              enum:
                                - AISERVICES_OPT_OUT_POLICY
                                - BACKUP_POLICY
                                - SERVICE_CONTROL_POLICY
                                - TAG_POLICY
                            AwsManaged:
                              type: boolean
                      SERVICE_CONTROL_POLICY:
                        type: array
                        items:
                          description: List of policies
                          type: object
                          minItems: 0
                          uniqueItems: true
                          required:
                            - Id
                            - Arn
                            - Name
                            - Type
                            - AwsManaged
                          properties:
                            Id:
                              type: string
                              example:
                                - p-FullAWSAccess
                                - p-v7joeyus
                            Arn:
                              type: string
                              example:
                                arn1:
                                  value: 'arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess'
                                arn2:
                                  value: 'arn:aws:organizations::150047381276:policy/o-njq6j1wsrz/service_control_policy/p-v7joeyus'
                            Name:
                              type: string
                              example:
                                - FullAWSAccess
                                - PreventAccessToDummy
                            Type:
                              type: string
                              enum:
                                - AISERVICES_OPT_OUT_POLICY
                                - BACKUP_POLICY
                                - SERVICE_CONTROL_POLICY
                                - TAG_POLICY
                            AwsManaged:
                              type: boolean
                      TAG_POLICY:
                        type: array
                        items:
                          description: List of policies
                          type: object
                          minItems: 0
                          uniqueItems: true
                          required:
                            - Id
                            - Arn
                            - Name
                            - Type
                            - AwsManaged
                          properties:
                            Id:
                              type: string
                              example:
                                - p-FullAWSAccess
                                - p-v7joeyus
                            Arn:
                              type: string
                              example:
                                arn1:
                                  value: 'arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess'
                                arn2:
                                  value: 'arn:aws:organizations::150047381276:policy/o-njq6j1wsrz/service_control_policy/p-v7joeyus'
                            Name:
                              type: string
                              example:
                                - FullAWSAccess
                                - PreventAccessToDummy
                            Type:
                              type: string
                              enum:
                                - AISERVICES_OPT_OUT_POLICY
                                - BACKUP_POLICY
                                - SERVICE_CONTROL_POLICY
                                - TAG_POLICY
                            AwsManaged:
                              type: boolean
                      accounts:
                        type: array
                        items:
                          description: List of accounts belonging to the OU
                          type: string
                          minItems: 0
                          uniqueItems: true
                          pattern: '[0-9]{12}'
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not found
        '500':
          description: Server error.  Try again.
      security:
        - UserPool:
            - hal/hal.readonly
      x-amazon-apigateway-integration:
        passthroughBehavior: when_no_match
        uri:
          'Fn::Sub': 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HalApiEndpoint.Arn}/invocations'
        httpMethod: POST
        type: aws_proxy
        contentHandling: CONVERT_TO_TEXT
        responses:
          default:
            statusCode: 200
            responseParameters:
              method.response.header.Access-Control-Allow-Headers: '''Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token,Api-Auth-Token'''
              method.response.header.Access-Control-Allow-Methods: '''*'''
              method.response.header.Access-Control-Allow-Origin: '''*'''
  /accountsandorgdata:
    get:
      tags:
        - accounts
      summary: Find accounts
      description: |
        Find accounts and org info
      operationId: findAccounts
      responses:
        '200':
          description: successful operation
          headers:
            Content-Type:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Headers:
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Definition for the accounts-to-org-units json
                additionalProperties:
                  type: object
                  required:
                    - Id
                    - Arn
                    - Email
                    - Name
                    - Status
                    - JoinedMethod
                    - JoinedTimestamp
                    - unit_path
                    - unit_id
                    - payer_account_id
                  properties:
                    Id:
                      type: string
                      pattern: '[0-9]{12}'
                      example:
                        Id1:
                          value: '837810110612'
                        Id2:
                          value: '138512462893'
                    Arn:
                      type: string
                      pattern: 'arn:aws:organizations::[0-9]{12}:account/o-[a-z0-9]*/[0-9]{12}'
                      example:
                        arn1:
                          value: 'arn:aws:organizations::150047381276:account/o-njq6j1wsrz/689157341164'
                        arn2:
                          value: 'arn:aws:organizations::150047381276:account/o-njq6j1wsrz/712176489324'
                    Email:
                      type: string
                      format: email
                      example:
                        email1:
                          value: aes-prd@amazon.pearson.com
                        email2:
                          value: 3plcg-nonprd@amazon.pearson.com
                    Name:
                      type: string
                      example:
                        name1:
                          value: aes-prd
                        name2:
                          value: 3plcg-nonprd
                    Status:
                      type: string
                      enum:
                        - ACTIVE
                        - SUSPENDED
                        - PENDING_CLOSURE
                    JoinedMethod:
                      type: string
                      enum:
                        - INVITED
                        - CREATED
                    JoinedTimestamp:
                      type: string
                      format: date-time
                    unit_path:
                      type: string
                      example:
                        oupath1:
                          value: Root/CIOMasterOU/Production
                        oupath2:
                          value: Root/CIOMasterOU/Non-Production
                    unit_id:
                      type: string
                      example:
                        ou1:
                          value: ou-pjk3-neqbpt9x
                        out2:
                          value: ou-pjk3-azmbm7vc
                    payer_account_id:
                      type: string
                      pattern: '[0-9]{12}'
                      example:
                        id1:
                          value: '150047381276'
                        id2:
                          value: '958342668309'
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not found
        '500':
          description: Server error.  Try again.
      security:
        - UserPool:
            - hal/hal.readonly
      x-amazon-apigateway-integration:
        passthroughBehavior: when_no_match
        httpMethod: POST
        uri:
          'Fn::Sub': 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HalApiEndpoint.Arn}/invocations'
        type: aws_proxy
        contentHandling: CONVERT_TO_TEXT
        responses:
          default:
            statusCode: 200
            responseParameters:
              method.response.header.Access-Control-Allow-Headers: '''Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token,Api-Auth-Token'''
              method.response.header.Access-Control-Allow-Methods: '''*'''
              method.response.header.Access-Control-Allow-Origin: '''*'''
  /:
    get:
      summary: API landing page
      operationId: APILandingPage
      responses:
        '200':
          description: Default 200 response for CORS method
          headers:
            Content-Type:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Headers:
              schema:
                type: string
          content: {}
        '404':
          description: API landing page not found
          headers:
            Content-Type:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
            Access-Control-Allow-Methods:
              schema:
                type: string
            Access-Control-Allow-Headers:
              schema:
                type: string
          content: {}
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: '200'
            responseParameters:
              method.response.header.Content-Type: '''text/html'''
              method.response.header.Access-Control-Allow-Headers: '''Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token,Api-Auth-Token'''
              method.response.header.Access-Control-Allow-Methods: '''DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'''
              method.response.header.Access-Control-Allow-Origin: '''http://localhost:3000'''
            responseTemplates:
              text/html: |
                <!DOCTYPE html> <html lang="en">
                  <head>
                    <meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters -->
                    <script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
                  </head>
                  <body>
                    <!-- Swagger build propagates info.version. Change the version in openapi.yaml, not here. v0.0.0 is a placeholder. -->
                    <rapi-doc spec-url = "https://downloads.pearsoncloudmanagement.com/hal/$context.stage/api/openapi_bundled_v1.0.4.yaml"> </rapi-doc>
                  </body>
                </html>
        requestTemplates:
          application/json: '{"statusCode": 200}'
        passthroughBehavior: when_no_match
        type: mock
externalDocs:
  description: Find out more about HAL and its Capabilities
  url: 'https://pearsoneducationinc.sharepoint.com/sites/PearsonCloudManagement/SitePages/Helpful-Asset-Locator-(HAL)---Introduction.aspx?web=1'
components:
  securitySchemes:
    UserPool:
      type: apiKey
      name: Authorization
      in: header
      x-amazon-apigateway-authtype: cognito_user_pools
      x-amazon-apigateway-authorizer:
        type: cognito_user_pools
        providerARNs:
          - 'Fn::Sub': '${UserPool.Arn}'
