Commit be780821 authored by Rucha Deshpande's avatar Rucha Deshpande
Browse files

Add stubs to dataecosystem, credentials and storage

commit 916afd66 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Fri Jan 15 2021 16:00:03 GMT-0600 (Central Standard Time) 

    Add skeletons for provider interfaces
parent 89f3a3a8
// Copyright © 2020 Amazon Web Services
//
// 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 { Config } from '../../../cloud';
import { Error, Utils } from '../../../shared';
import { AbstractCredentials, CredentialsFactory, IAccessTokenModel } from '../../credentials';
import { AWSConfig } from './config';
@CredentialsFactory.register('aws')
export class AWSCredentials extends AbstractCredentials {
getAudienceForImpCredentials(): string {
return '';
}
getIAMResourceUrl(serviceSigner: string): string {
return '';
}
getPublicKeyCertificatesUrl(): string {
return '';
}
async getServiceAccountAccessToken(): Promise<IAccessTokenModel> {
return undefined;
}
async getUserCredentials(subject: string): Promise<IAccessTokenModel> {
return undefined;
}
// this will return serviceprincipal access token
public async getServiceCredentials(): Promise<string> {
return ''
}
}
\ No newline at end of file
// Copyright © 2020 Amazon Web Services
//
// 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,
IDESEntitlementGroupMembersModel } from '../../dataecosystem';
import { AWSCredentials } from './credentials';
@DataEcosystemCoreFactory.register('aws')
export class AWSDataEcosystemServices extends AbstractDataEcosystemCore {
public getDataPartitionIDRestHeaderName(): string { return 'data-partition-id'; }
public getEntitlementBaseUrlPath(): string { return '/entitlements/v1'; };
public getComplianceBaseUrlPath(): string { return '/legal/v1'; };
public getStorageBaseUrlPath(): string { return '/storage/v2'; };
public async getAuthorizationHeader(userToken: string): Promise<string> {
return 'Bearer ' + await new AWSCredentials().getServiceCredentials();
}
public fixGroupMembersResponse(groupMembers: any): IDESEntitlementGroupMembersModel {
return groupMembers as IDESEntitlementGroupMembersModel;
}
public getUserAddBodyRequest(userEmail: string, role: string): {email: string, role: string} | string[] {
return { email: userEmail, role }
}
public tenantNameAndDataPartitionIDShouldMatch() {
return false;
}
}
\ No newline at end of file
......@@ -24,7 +24,7 @@ const converter = aws.DynamoDB.Converter;
@JournalFactory.register('aws')
export class AWSDynamoDbDAO extends AbstractJournal {
public KEY = Symbol('id');;
public KEY = Symbol('id');
public constructor(tenant: TenantModel) {
super();
AWS.config.update({ region: AWSConfig.AWS_REGION });
......
......@@ -13,8 +13,8 @@
// limitations under the License.
export { AWSConfig } from './config';
//export { AwsStorage } from './storage';
//export { Credentials } from './credentials';
export { AWSStorage } from './storage';
export { AWSCredentials } from './credentials';
export { AWSDynamoDbDAO} from './dynamodb';
export { AwsTrace } from './trace';
//export { AwsDataEcosystemServices } from './dataecosystem';
\ No newline at end of file
export { AWSDataEcosystemServices } from './dataecosystem';
\ No newline at end of file
// Copyright © 2020 Amazon Web Services
//
// 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 {AbstractStorage, StorageFactory} from '../../storage';
@StorageFactory.register('aws')
export class AWSStorage extends AbstractStorage {
async bucketExists(bucketName: string): Promise<boolean> {
return undefined;
}
// tslint:disable-next-line:max-line-length
async copy(bucketIn: string, prefixIn: string, bucketOut: string, prefixOut: string, ownerEmail: string): Promise<void> {
return undefined;
}
// tslint:disable-next-line:max-line-length
async createBucket(bucketName: string, location: string, storageClass: string, adminACL: string, editorACL: string, viewerACL: string): Promise<void> {
return undefined;
}
async deleteBucket(bucketName: string): Promise<void>;
deleteBucket(bucketName: string): void;
deleteBucket(bucketName: string): Promise<void> | void {
return undefined;
}
async deleteFiles(bucketName: string): Promise<void> {
return undefined;
}
async deleteObject(bucketName: string, objectName: string): Promise<void> {
return undefined;
}
async deleteObjects(bucketName: string, prefix: string): Promise<void> {
return undefined;
}
randomBucketName(): string {
return '';
}
async saveObject(bucketName: string, objectName: string, data: string): Promise<void> {
return undefined;
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@ export class TenantHandler {
try {
// tenant endpoints are not available with impersonation token
//tenant endpoints are not available with impersonation token
if (Auth.isImpersonationToken(req.headers.authorization)) {
throw (Error.make(Error.Status.PERMISSION_DENIED,
'tenant endpoints not available' +
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment