AWSTemplateFormatVersion: '2010-09-09'
Description: Admin API Gateway
Parameters:
  EnvironmentName:
    Description: An environment name that is prefixed to resource names
    Type: String

Resources:
  AdminApiGateway:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Description: The admin API gateway
      EndpointConfiguration:
        Types:
          - REGIONAL
      Name: !Sub admin-${EnvironmentName}

  AdminApiGatewayRootMethod:
    Type: AWS::ApiGateway::Method
    Properties:
      AuthorizationType: NONE
      HttpMethod: OPTIONS
      Integration:
        IntegrationHttpMethod: OPTIONS
        Type: MOCK
      ResourceId: !GetAtt AdminApiGateway.RootResourceId
      RestApiId: !Ref AdminApiGateway

  CognitoAuthorizer: 
    Type: AWS::ApiGateway::Authorizer
    Properties:
      Name: CognitoAuthorizer
      Type: COGNITO_USER_POOLS
      ProviderARNs: 
        - Fn::ImportValue:
            !Sub "${EnvironmentName}AdminUserPool::ARN" 
      AuthType: "cognito_user_pools"
      IdentitySource: "method.request.header.idtoken"
      RestApiId: 
        Ref: AdminApiGateway

  SuperAdminAuthorizer:
    Type: 'AWS::ApiGateway::Authorizer'
    Properties:
      AuthorizerCredentials: !GetAtt 
      - SuperAdminAuthorizerRole
      - Arn
      AuthorizerResultTtlInSeconds: 0
      AuthorizerUri: !Join 
        - ''
        - - 'arn:aws:apigateway:'
          - !Ref 'AWS::Region'
          - ':lambda:path/2015-03-31/functions/'
          - !ImportValue 
            'Fn::Sub': 'SuperAdminAuthorizeARN-${EnvironmentName}'
          - /invocations
      Type: TOKEN
      IdentitySource: method.request.header.accesstoken
      Name: SuperAdminAuthorizer
      RestApiId: !Ref AdminApiGateway

  PrescriptionAuthorizer:
    Type: 'AWS::ApiGateway::Authorizer'
    Properties:
      AuthorizerCredentials: !GetAtt 
        - PrescriptionAuthorizerRole
        - Arn
      AuthorizerResultTtlInSeconds: 0
      AuthorizerUri: !Join 
        - ''
        - - 'arn:aws:apigateway:'
          - !Ref 'AWS::Region'
          - ':lambda:path/2015-03-31/functions/'
          - !ImportValue 
            'Fn::Sub': 'PrescriptionAuthorizeARN-${EnvironmentName}'
          - /invocations
      Type: TOKEN
      IdentitySource: method.request.header.accesstoken
      Name: PrescriptionAuthorizer
      RestApiId: !Ref AdminApiGateway

  FulfilmentAuthorizer:
    Type: 'AWS::ApiGateway::Authorizer'
    Properties:
      AuthorizerCredentials: !GetAtt 
        - FulfilmentAuthorizerRole
        - Arn
      AuthorizerResultTtlInSeconds: 0
      AuthorizerUri: !Join 
        - ''
        - - 'arn:aws:apigateway:'
          - !Ref 'AWS::Region'
          - ':lambda:path/2015-03-31/functions/'
          - !ImportValue 
            'Fn::Sub': 'FulfilmentAuthorizeARN-${EnvironmentName}'
          - /invocations
      Type: TOKEN
      IdentitySource: method.request.header.accesstoken
      Name: FulfilmentAuthorizer
      RestApiId: !Ref AdminApiGateway

  PackagingAuthorizer:
    Type: 'AWS::ApiGateway::Authorizer'
    Properties:
      AuthorizerCredentials: !GetAtt 
        - PackagingAuthorizerRole
        - Arn
      AuthorizerResultTtlInSeconds: 0
      AuthorizerUri: !Join 
        - ''
        - - 'arn:aws:apigateway:'
          - !Ref 'AWS::Region'
          - ':lambda:path/2015-03-31/functions/'
          - !ImportValue 
            'Fn::Sub': 'PackagingAuthorizeARN-${EnvironmentName}'
          - /invocations
      Type: TOKEN
      IdentitySource: method.request.header.accesstoken
      Name: PackagingAuthorizer
      RestApiId: !Ref AdminApiGateway

  CustomerAuthorizer:
    Type: 'AWS::ApiGateway::Authorizer'
    Properties:
      AuthorizerCredentials: !GetAtt 
        - CustomerAuthorizerRole
        - Arn
      AuthorizerResultTtlInSeconds: 0
      AuthorizerUri: !Join 
        - ''
        - - 'arn:aws:apigateway:'
          - !Ref 'AWS::Region'
          - ':lambda:path/2015-03-31/functions/'
          - !ImportValue 
            'Fn::Sub': 'CustomerAuthorizeARN-${EnvironmentName}'
          - /invocations
      Type: TOKEN
      IdentitySource: method.request.header.accesstoken
      Name: CustomerAuthorizer
      RestApiId: !Ref AdminApiGateway

  InternalAuthorizer:
    Type: 'AWS::ApiGateway::Authorizer'
    Properties:
      AuthorizerCredentials: !GetAtt 
        - InternalAuthorizerRole
        - Arn
      AuthorizerResultTtlInSeconds: 0
      AuthorizerUri: !Join 
        - ''
        - - 'arn:aws:apigateway:'
          - !Ref 'AWS::Region'
          - ':lambda:path/2015-03-31/functions/'
          - !ImportValue 
            'Fn::Sub': 'InternalAuthorizeARN-${EnvironmentName}'
          - /invocations
      Type: TOKEN
      IdentitySource: method.request.header.accesstoken
      Name: InternalAuthorizer
      RestApiId: !Ref AdminApiGateway

  SuperAdminAuthorizerRole:
      Type: AWS::IAM::Role
      Properties:
        RoleName: !Sub SuperAdminAuthorizerRole-${EnvironmentName}
        AssumeRolePolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - apigateway.amazonaws.com
              Action: sts:AssumeRole

  SuperAdminAuthorizerPolicy:
      Type: AWS::IAM::Policy
      Properties:
        PolicyName: !Sub SuperAdminAuthorizerPolicy-${EnvironmentName}
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action:
                - lambda:InvokeFunction
              Resource:
                !ImportValue 
                'Fn::Sub': 'SuperAdminAuthorizeARN-${EnvironmentName}'
        Roles:
          - Ref: SuperAdminAuthorizerRole

  PrescriptionAuthorizerRole:
      Type: AWS::IAM::Role
      Properties:
        RoleName: !Sub PrescriptionAuthorizerRole-${EnvironmentName}
        AssumeRolePolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - apigateway.amazonaws.com
              Action: sts:AssumeRole

  PrescriptionAuthorizerPolicy:
      Type: AWS::IAM::Policy
      Properties:
        PolicyName: !Sub PrescriptionAuthorizerPolicy-${EnvironmentName}
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action:
                - lambda:InvokeFunction
              Resource:
                !ImportValue 
                'Fn::Sub': 'PrescriptionAuthorizeARN-${EnvironmentName}'
        Roles:
          - Ref: PrescriptionAuthorizerRole

  FulfilmentAuthorizerRole:
      Type: AWS::IAM::Role
      Properties:
        RoleName: !Sub FulfilmentAuthorizerRole-${EnvironmentName}
        AssumeRolePolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - apigateway.amazonaws.com
              Action: sts:AssumeRole

  FulfilmentAuthorizerPolicy:
      Type: AWS::IAM::Policy
      Properties:
        PolicyName: !Sub FulfilmentAuthorizerPolicy-${EnvironmentName}
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action:
                - lambda:InvokeFunction
              Resource:
                !ImportValue 
                'Fn::Sub': 'FulfilmentAuthorizeARN-${EnvironmentName}'
        Roles:
          - Ref: FulfilmentAuthorizerRole

  PackagingAuthorizerRole:
      Type: AWS::IAM::Role
      Properties:
        RoleName: !Sub PackagingAuthorizerRole-${EnvironmentName}
        AssumeRolePolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - apigateway.amazonaws.com
              Action: sts:AssumeRole

  PackagingAuthorizerPolicy:
      Type: AWS::IAM::Policy
      Properties:
        PolicyName: !Sub PackagingAuthorizerPolicy-${EnvironmentName}
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action:
                - lambda:InvokeFunction
              Resource:
                !ImportValue 
                'Fn::Sub': 'PackagingAuthorizeARN-${EnvironmentName}'
        Roles:
          - Ref: PackagingAuthorizerRole

  CustomerAuthorizerRole:
      Type: AWS::IAM::Role
      Properties:
        RoleName: !Sub CustomerAuthorizerRole-${EnvironmentName}
        AssumeRolePolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - apigateway.amazonaws.com
              Action: sts:AssumeRole

  CustomerAuthorizerPolicy:
      Type: AWS::IAM::Policy
      Properties:
        PolicyName: !Sub CustomerAuthorizerPolicy-${EnvironmentName}
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action:
                - lambda:InvokeFunction
              Resource:
                !ImportValue 
                'Fn::Sub': 'CustomerAuthorizeARN-${EnvironmentName}'
        Roles:
          - Ref: CustomerAuthorizerRole

  InternalAuthorizerRole:
      Type: AWS::IAM::Role
      Properties:
        RoleName: !Sub InternalAuthorizerRole-${EnvironmentName}
        AssumeRolePolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - apigateway.amazonaws.com
              Action: sts:AssumeRole

  InternalAuthorizerPolicy:
      Type: AWS::IAM::Policy
      Properties:
        PolicyName: !Sub InternalAuthorizerPolicy-${EnvironmentName}
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action:
                - lambda:InvokeFunction
              Resource:
                !ImportValue 
                'Fn::Sub': 'InternalAuthorizeARN-${EnvironmentName}'
        Roles:
          - Ref: InternalAuthorizerRole

  # Gateway Responses
  AdminGatewayResponseAccessDenied:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: ACCESS_DENIED
      RestApiId: !Ref AdminApiGateway
      StatusCode: '403'

  AdminGatewayResponseApiConfigurationError:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: API_CONFIGURATION_ERROR
      RestApiId: !Ref AdminApiGateway
      StatusCode: '500'

  AdminGatewayResponseAuthorizerFailure:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: AUTHORIZER_FAILURE
      RestApiId: !Ref AdminApiGateway
      StatusCode: '500'

  AdminGatewayResponseAuthorizerConfigurationError:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: AUTHORIZER_CONFIGURATION_ERROR
      RestApiId: !Ref AdminApiGateway
      StatusCode: '500'

  AdminGatewayResponseBadRequestParameters:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: BAD_REQUEST_PARAMETERS
      RestApiId: !Ref AdminApiGateway
      StatusCode: '400'

  AdminGatewayResponseBadRequestBody:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: BAD_REQUEST_BODY
      RestApiId: !Ref AdminApiGateway
      StatusCode: '400'

  AdminGatewayResponseDefault4xx:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: DEFAULT_4XX
      RestApiId: !Ref AdminApiGateway

  AdminGatewayResponseDefault5xx:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: DEFAULT_5XX
      RestApiId: !Ref AdminApiGateway
        
  AdminGatewayResponseExpiredToken:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: EXPIRED_TOKEN
      RestApiId: !Ref AdminApiGateway
      StatusCode: '403'

  AdminGatewayResponseInvalidSignature:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: INVALID_SIGNATURE
      RestApiId: !Ref AdminApiGateway
      StatusCode: '403'

  AdminGatewayResponseIntegrationFailure:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: INTEGRATION_FAILURE
      RestApiId: !Ref AdminApiGateway
      StatusCode: '502'

  AdminGatewayResponseIntegrationTimeout:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: INTEGRATION_TIMEOUT
      RestApiId: !Ref AdminApiGateway
      StatusCode: '504'

  AdminGatewayResponseInvalidApiKey:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: INVALID_API_KEY
      RestApiId: !Ref AdminApiGateway
      StatusCode: '403'
        
  AdminGatewayResponseMissingAuthenticationToken:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: MISSING_AUTHENTICATION_TOKEN
      RestApiId: !Ref AdminApiGateway
      StatusCode: '400'

  AdminGatewayResponseQuotaExceeded:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: QUOTA_EXCEEDED
      RestApiId: !Ref AdminApiGateway
      StatusCode: '429'

  AdminGatewayResponseRequestTooLarge:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: REQUEST_TOO_LARGE
      RestApiId: !Ref AdminApiGateway
      StatusCode: '413'

  AdminGatewayResponseResourceNotFound:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: RESOURCE_NOT_FOUND
      RestApiId: !Ref AdminApiGateway
      StatusCode: '404'

  AdminGatewayResponseThrottled:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: THROTTLED
      RestApiId: !Ref AdminApiGateway
      StatusCode: '429'
        
  AdminGatewayResponseUnauthorized:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: UNAUTHORIZED
      RestApiId: !Ref AdminApiGateway
      StatusCode: '401'

  AdminGatewayResponseUnsupportedMediaType:
    Type: 'AWS::ApiGateway::GatewayResponse'
    Properties:
      ResponseParameters:
        gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
        gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,AccessToken,X-Api-Key,X-Amz-Security-Token'"
        gatewayresponse.header.Access-Control-Allow-Methods: "'GET,PUT,DELETE,POST,OPTIONS'"
      ResponseType: UNSUPPORTED_MEDIA_TYPE
      RestApiId: !Ref AdminApiGateway
      StatusCode: '415'

Outputs:
  AdminApiGateway:
    Value: !Ref AdminApiGateway
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGateway"
  AdminApiGatewayResourceId:
    Value: !GetAtt AdminApiGateway.RootResourceId
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewayResourceId"
  AdminApiGatewaySuperAdminAuthorizerId:
    Value: !Ref SuperAdminAuthorizer
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewaySuperAdminAuthorizerId"
  AdminApiGatewayPrescriptionAuthorizerId:
    Value: !Ref PrescriptionAuthorizer
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewayPrescriptionAuthorizerId"
  AdminApiGatewayFulfilmentAuthorizerId:
    Value: !Ref FulfilmentAuthorizer
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewayFulfilmentAuthorizerId"
  AdminApiGatewayPackagingAuthorizerId:
    Value: !Ref PackagingAuthorizer
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewayPackagingAuthorizerId"
  AdminApiGatewayCustomerAuthorizerId:
    Value: !Ref CustomerAuthorizer
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewayCustomerAuthorizerId"
  AdminApiGatewayCognitoAuthorizerId:
    Value: !Ref CognitoAuthorizer
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewayCognitoAuthorizerId"
  AdminApiGatewayInternalAuthorizerId:
    Value: !Ref InternalAuthorizer
    Export:
      Name: !Sub "${EnvironmentName}AdminApiGatewayInternalAuthorizerId"
 