|
|
@ -8,6 +8,8 @@ module S3Module { |
|
|
region: string |
|
|
region: string |
|
|
accessKeyId: string |
|
|
accessKeyId: string |
|
|
secretAccessKey: string |
|
|
secretAccessKey: string |
|
|
|
|
|
s3ForcePathStyle: boolean |
|
|
|
|
|
endpoint?: string |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const SCHEMA: Integration = { |
|
|
const SCHEMA: Integration = { |
|
|
@ -18,7 +20,7 @@ module S3Module { |
|
|
datasource: { |
|
|
datasource: { |
|
|
region: { |
|
|
region: { |
|
|
type: "string", |
|
|
type: "string", |
|
|
required: true, |
|
|
required: false, |
|
|
default: "us-east-1", |
|
|
default: "us-east-1", |
|
|
}, |
|
|
}, |
|
|
accessKeyId: { |
|
|
accessKeyId: { |
|
|
@ -29,6 +31,15 @@ module S3Module { |
|
|
type: "password", |
|
|
type: "password", |
|
|
required: true, |
|
|
required: true, |
|
|
}, |
|
|
}, |
|
|
|
|
|
endpoint: { |
|
|
|
|
|
type: "string", |
|
|
|
|
|
required: false, |
|
|
|
|
|
}, |
|
|
|
|
|
signatureVersion: { |
|
|
|
|
|
type: "string", |
|
|
|
|
|
required: false, |
|
|
|
|
|
default: "v4" |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
query: { |
|
|
query: { |
|
|
read: { |
|
|
read: { |
|
|
@ -46,16 +57,16 @@ module S3Module { |
|
|
class S3Integration implements IntegrationBase { |
|
|
class S3Integration implements IntegrationBase { |
|
|
private readonly config: S3Config |
|
|
private readonly config: S3Config |
|
|
private client: any |
|
|
private client: any |
|
|
private connectionPromise: Promise<any> |
|
|
|
|
|
|
|
|
|
|
|
constructor(config: S3Config) { |
|
|
constructor(config: S3Config) { |
|
|
this.config = config |
|
|
this.config = config |
|
|
this.connectionPromise = this.connect() |
|
|
if (this.config.endpoint) { |
|
|
this.client = new AWS.S3() |
|
|
this.config.s3ForcePathStyle = true |
|
|
} |
|
|
} else { |
|
|
|
|
|
delete this.config.endpoint |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async connect() { |
|
|
this.client = new AWS.S3(this.config) |
|
|
AWS.config.update(this.config) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async read(query: { bucket: string }) { |
|
|
async read(query: { bucket: string }) { |
|
|
|