dataecosystem.ts 1.83 KB
Newer Older
Yunhua Koglin's avatar
Yunhua Koglin committed
1
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {
    AbstractDataEcosystemCore,
    DataEcosystemCoreFactory,
18
19
    IDESEntitlementGroupMembersModel
} from '../../dataecosystem';
20
21
22

@DataEcosystemCoreFactory.register('aws')
export class AWSDataEcosystemServices extends AbstractDataEcosystemCore {
23

24
    public getDataPartitionIDRestHeaderName(): string { return 'data-partition-id'; }
25
    public getEntitlementBaseUrlPath(): string { return '/api/entitlements/v2'; };
26
27
    public getComplianceBaseUrlPath(): string { return '/api/legal/v1'; };
    public getStorageBaseUrlPath(): string { return '/api/storage/v2'; };
28
    public getUserAssociationSvcBaseUrlPath(): string { return 'userAssociation/v1'; }
29
30

    public async getAuthorizationHeader(userToken: string): Promise<string> {
31
        return userToken.startsWith('Bearer') ? userToken : 'Bearer ' + userToken;
32
33
34
35
36
37
    }

    public fixGroupMembersResponse(groupMembers: any): IDESEntitlementGroupMembersModel {
        return groupMembers as IDESEntitlementGroupMembersModel;
    }

38
39
    public getUserAddBodyRequest(userEmail: string, role: string): { email: string, role: string; } | string[] {
        return { email: userEmail, role };
40
41
42
43
44
45
    }

    public tenantNameAndDataPartitionIDShouldMatch() {
        return false;
    }

46
}