@reventlessdev/rescript-aws-sdk 2.2.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +174 -0
- package/LICENSE +202 -0
- package/README.md +21 -0
- package/package.json +44 -0
- package/rescript.json +23 -0
- package/src/CloudWatchEvents.res +162 -0
- package/src/CloudWatchEvents.res.mjs +94 -0
- package/src/CognitoIdentityServiceProvider.res +117 -0
- package/src/CognitoIdentityServiceProvider.res.mjs +70 -0
- package/src/DynamoDb.res +3 -0
- package/src/DynamoDb.res.mjs +15 -0
- package/src/DynamoDb_DocumentClient.res +905 -0
- package/src/DynamoDb_DocumentClient.res.mjs +338 -0
- package/src/DynamoDb_DynamoDb.res +189 -0
- package/src/DynamoDb_DynamoDb.res.mjs +70 -0
- package/src/DynamoDb_Util.res +128 -0
- package/src/DynamoDb_Util.res.mjs +35 -0
- package/src/DynamoDb_Util_Helpers.res +7 -0
- package/src/DynamoDb_Util_Helpers.res.mjs +23 -0
- package/src/ECS.res +96 -0
- package/src/ECS.res.mjs +46 -0
- package/src/IAM.res +20 -0
- package/src/IAM.res.mjs +9 -0
- package/src/Kinesis.res +50 -0
- package/src/Kinesis.res.mjs +39 -0
- package/src/Metadata.res +9 -0
- package/src/Metadata.res.mjs +2 -0
- package/src/NodeHttpHandler.res +6 -0
- package/src/NodeHttpHandler.res.mjs +2 -0
- package/src/S3.res +152 -0
- package/src/S3.res.mjs +61 -0
- package/src/S3_Helpers.res +20 -0
- package/src/S3_Helpers.res.mjs +26 -0
- package/src/SES.res +113 -0
- package/src/SES.res.mjs +59 -0
- package/src/SNS.res +167 -0
- package/src/SNS.res.mjs +98 -0
- package/src/SNS_Helpers.res +45 -0
- package/src/SNS_Helpers.res.mjs +57 -0
- package/src/SQS.res +241 -0
- package/src/SQS.res.mjs +121 -0
- package/src/SQS_Helpers.res +267 -0
- package/src/SQS_Helpers.res.mjs +227 -0
- package/src/SecretsManager.res +61 -0
- package/src/SecretsManager.res.mjs +46 -0
- package/src/example/DynamoDbUtilExample.res +20 -0
- package/src/example/DynamoDbUtilExample.res.mjs +66 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function topLevelContainerConverted(convertEmptyValues, removeUndefinedValues, convertClassInstanceToMap, wrapNumbers) {
|
|
5
|
+
return {
|
|
6
|
+
convertEmptyValues: convertEmptyValues,
|
|
7
|
+
removeUndefinedValues: removeUndefinedValues,
|
|
8
|
+
convertClassInstanceToMap: convertClassInstanceToMap,
|
|
9
|
+
convertTopLevelContainer: true,
|
|
10
|
+
wrapNumbers: wrapNumbers
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function topLevelContainerNotConverted(convertEmptyValues, removeUndefinedValues, convertClassInstanceToMap, wrapNumbers) {
|
|
15
|
+
return {
|
|
16
|
+
convertEmptyValues: convertEmptyValues,
|
|
17
|
+
removeUndefinedValues: removeUndefinedValues,
|
|
18
|
+
convertClassInstanceToMap: convertClassInstanceToMap,
|
|
19
|
+
convertTopLevelContainer: false,
|
|
20
|
+
wrapNumbers: wrapNumbers
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let MarshallOptions = {
|
|
25
|
+
topLevelContainerConverted: topLevelContainerConverted,
|
|
26
|
+
topLevelContainerNotConverted: topLevelContainerNotConverted
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let Raw = {};
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
MarshallOptions,
|
|
33
|
+
Raw,
|
|
34
|
+
}
|
|
35
|
+
/* No side effect */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
let unmarshallDict: (~wrapNumbers: bool=?, dict<DynamoDb_Util.attributeValue>) => 'output = (
|
|
2
|
+
~wrapNumbers=?,
|
|
3
|
+
data,
|
|
4
|
+
) => DynamoDb_Util.Raw.unmarshall(data, ~options={?wrapNumbers, convertWithoutMapWrapper: false})
|
|
5
|
+
|
|
6
|
+
let unmarshall: (~wrapNumbers: bool=?, DynamoDb_Util.attributeValue) => 'output = (~wrapNumbers=?, data) =>
|
|
7
|
+
DynamoDb_Util.Raw.unmarshall(data, ~options={?wrapNumbers, convertWithoutMapWrapper: true})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as UtilDynamodb from "@aws-sdk/util-dynamodb";
|
|
4
|
+
|
|
5
|
+
function unmarshallDict(wrapNumbers, data) {
|
|
6
|
+
return UtilDynamodb.unmarshall(data, {
|
|
7
|
+
convertWithoutMapWrapper: false,
|
|
8
|
+
wrapNumbers: wrapNumbers
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function unmarshall(wrapNumbers, data) {
|
|
13
|
+
return UtilDynamodb.unmarshall(data, {
|
|
14
|
+
convertWithoutMapWrapper: true,
|
|
15
|
+
wrapNumbers: wrapNumbers
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
unmarshallDict,
|
|
21
|
+
unmarshall,
|
|
22
|
+
}
|
|
23
|
+
/* @aws-sdk/util-dynamodb Not a pure module */
|
package/src/ECS.res
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**aws-sdk/ecs
|
|
2
|
+
see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/
|
|
3
|
+
**/
|
|
4
|
+
type client
|
|
5
|
+
|
|
6
|
+
type options = {
|
|
7
|
+
region?: string,
|
|
8
|
+
maxAttempts?: int,
|
|
9
|
+
requestHandler?: NodeHttpHandler.t,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module Raw = {
|
|
13
|
+
@module("@aws-sdk/client-ecs") @new
|
|
14
|
+
external client: (options, unit) => client = "ECSClient"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let instance = ref(None)
|
|
18
|
+
|
|
19
|
+
let client = () =>
|
|
20
|
+
switch instance.contents {
|
|
21
|
+
| None =>
|
|
22
|
+
let client = Raw.client(
|
|
23
|
+
{
|
|
24
|
+
maxAttempts: 3,
|
|
25
|
+
requestHandler: NodeHttpHandler.make({
|
|
26
|
+
connectionTimeout: 1000,
|
|
27
|
+
requestTimeout: 5000,
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
(),
|
|
31
|
+
)
|
|
32
|
+
instance := Some(client)
|
|
33
|
+
client
|
|
34
|
+
| Some(client) => client
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type containerOverride = {
|
|
38
|
+
/** name of the container that receives the override. This parameter is required if any override is specified. */
|
|
39
|
+
name?: string,
|
|
40
|
+
/** command to send to the container that overrides the default command from the Docker image */
|
|
41
|
+
command?: array<string>,
|
|
42
|
+
/** environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name. */
|
|
43
|
+
environment?: dict<string>,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type taskOverride = {containerOverrides?: array<containerOverride>}
|
|
47
|
+
|
|
48
|
+
type awsVpcConfiguration = {subnets: array<string>}
|
|
49
|
+
|
|
50
|
+
type networkConfiguration = {awsvpcConfiguration?: awsVpcConfiguration}
|
|
51
|
+
|
|
52
|
+
module RunTaskCommand = {
|
|
53
|
+
type t
|
|
54
|
+
|
|
55
|
+
type launchType = [#EC2 | #FARGATE | #EXTERNAL]
|
|
56
|
+
|
|
57
|
+
type input = {
|
|
58
|
+
/** The family and revision (family:revision) or full ARN of the task definition to run.
|
|
59
|
+
If a revision is not specified, the latest ACTIVE revision is used. */
|
|
60
|
+
taskDefinition: string,
|
|
61
|
+
/** infrastructure on which to run your standalone task. */
|
|
62
|
+
launchType?: launchType,
|
|
63
|
+
/** short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. */
|
|
64
|
+
cluster?: string,
|
|
65
|
+
/** network configuration for the task. This parameter is required for task definitions
|
|
66
|
+
that use the awsvpc network mode to receive their own elastic network interface, and it is not supported for other network modes. */
|
|
67
|
+
networkConfiguration?: networkConfiguration,
|
|
68
|
+
/** number of instantiations of the specified task to place on your cluster. */
|
|
69
|
+
count?: int,
|
|
70
|
+
/** list of container overrides in JSON format that specify the name of a container in the specified task definition and the overrides it should receive. */
|
|
71
|
+
overrides?: taskOverride,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type task = {taskArn: string}
|
|
75
|
+
|
|
76
|
+
type failure = {
|
|
77
|
+
arn: string,
|
|
78
|
+
reason: string,
|
|
79
|
+
detail: string,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
type output = {
|
|
83
|
+
tasks: array<task>,
|
|
84
|
+
failures: array<failure>,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@new @module("@aws-sdk/client-ecs")
|
|
88
|
+
external make: input => t = "RunTaskCommand"
|
|
89
|
+
|
|
90
|
+
module Raw = {
|
|
91
|
+
@send
|
|
92
|
+
external send: (client, t) => promise<output> = "send"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let send: t => promise<output> = command => Raw.send(client(), command)
|
|
96
|
+
}
|
package/src/ECS.res.mjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
4
|
+
import * as ClientEcs from "@aws-sdk/client-ecs";
|
|
5
|
+
import * as NodeHttpHandler from "@smithy/node-http-handler";
|
|
6
|
+
|
|
7
|
+
let Raw = {};
|
|
8
|
+
|
|
9
|
+
let instance = {
|
|
10
|
+
contents: undefined
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function client() {
|
|
14
|
+
let client$1 = instance.contents;
|
|
15
|
+
if (client$1 !== undefined) {
|
|
16
|
+
return Primitive_option.valFromOption(client$1);
|
|
17
|
+
}
|
|
18
|
+
let client$2 = new ClientEcs.ECSClient({
|
|
19
|
+
maxAttempts: 3,
|
|
20
|
+
requestHandler: Primitive_option.some(new NodeHttpHandler.NodeHttpHandler({
|
|
21
|
+
connectionTimeout: 1000,
|
|
22
|
+
requestTimeout: 5000
|
|
23
|
+
}))
|
|
24
|
+
});
|
|
25
|
+
instance.contents = Primitive_option.some(client$2);
|
|
26
|
+
return client$2;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let Raw$1 = {};
|
|
30
|
+
|
|
31
|
+
function send(command) {
|
|
32
|
+
return client().send(command);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let RunTaskCommand = {
|
|
36
|
+
Raw: Raw$1,
|
|
37
|
+
send: send
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
Raw,
|
|
42
|
+
instance,
|
|
43
|
+
client,
|
|
44
|
+
RunTaskCommand,
|
|
45
|
+
}
|
|
46
|
+
/* @aws-sdk/client-ecs Not a pure module */
|
package/src/IAM.res
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Policy = {
|
|
2
|
+
type arnEquals = {@as("aws:SourceArn") awsSourceArn: string}
|
|
3
|
+
|
|
4
|
+
type condition = {@as("ArnEquals") arnEquals: arnEquals}
|
|
5
|
+
|
|
6
|
+
type statement = {
|
|
7
|
+
@as("Sid") sid: string,
|
|
8
|
+
@as("Effect") effect: string,
|
|
9
|
+
@as("Principal") principal: string,
|
|
10
|
+
@as("Action") action: string,
|
|
11
|
+
@as("Resource") resource: string,
|
|
12
|
+
@as("Condition") condition?: condition, // FIXME: verify optional field is correct
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type t = {
|
|
16
|
+
@as("Version") version: string,
|
|
17
|
+
@as("Id") id: string,
|
|
18
|
+
@as("Statement") statement: array<statement>,
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/IAM.res.mjs
ADDED
package/src/Kinesis.res
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*** aws-sdk/Kinesis
|
|
2
|
+
see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/kinesis/
|
|
3
|
+
*/
|
|
4
|
+
type client
|
|
5
|
+
|
|
6
|
+
module Raw = {
|
|
7
|
+
@module("@aws-sdk/client-kinesis") @new
|
|
8
|
+
external client: unit => client = "KinesisClient"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let clientInstance = ref(None)
|
|
12
|
+
|
|
13
|
+
/** create a CloudWatchEventsClient with no default values
|
|
14
|
+
use `Raw.client` if you want to set alternative configuration
|
|
15
|
+
*/
|
|
16
|
+
let client = () =>
|
|
17
|
+
switch clientInstance.contents {
|
|
18
|
+
| None =>
|
|
19
|
+
let client = Raw.client()
|
|
20
|
+
clientInstance := Some(client)
|
|
21
|
+
client
|
|
22
|
+
| Some(client) => client
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module PutRecordCommand = {
|
|
26
|
+
type input = {
|
|
27
|
+
@as("Data") data: string,
|
|
28
|
+
@as("StreamName") streamName: string,
|
|
29
|
+
@as("PartitionKey") partitionKey: string,
|
|
30
|
+
@as("ExplicitHashKey") explicitHashKey?: string,
|
|
31
|
+
@as("SequenceNumberForOrdering") sequenceNumberForOrdering?: string,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type output = {
|
|
35
|
+
@as("ShardId") shardId: string,
|
|
36
|
+
@as("SequenceNumber") sequenceNumber?: string,
|
|
37
|
+
@as("EncryptionType") encryptionType: option<string>,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type t
|
|
41
|
+
@new @module("@aws-sdk/client-kinesis")
|
|
42
|
+
external make: input => t = "PutRecordCommand"
|
|
43
|
+
|
|
44
|
+
module Raw = {
|
|
45
|
+
@send
|
|
46
|
+
external send: (client, t) => promise<output> = "send"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let send: t => promise<output> = command => Raw.send(client(), command)
|
|
50
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
4
|
+
import * as ClientKinesis from "@aws-sdk/client-kinesis";
|
|
5
|
+
|
|
6
|
+
let Raw = {};
|
|
7
|
+
|
|
8
|
+
let clientInstance = {
|
|
9
|
+
contents: undefined
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function client() {
|
|
13
|
+
let client$1 = clientInstance.contents;
|
|
14
|
+
if (client$1 !== undefined) {
|
|
15
|
+
return Primitive_option.valFromOption(client$1);
|
|
16
|
+
}
|
|
17
|
+
let client$2 = new ClientKinesis.KinesisClient();
|
|
18
|
+
clientInstance.contents = Primitive_option.some(client$2);
|
|
19
|
+
return client$2;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let Raw$1 = {};
|
|
23
|
+
|
|
24
|
+
function send(command) {
|
|
25
|
+
return client().send(command);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let PutRecordCommand = {
|
|
29
|
+
Raw: Raw$1,
|
|
30
|
+
send: send
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
Raw,
|
|
35
|
+
clientInstance,
|
|
36
|
+
client,
|
|
37
|
+
PutRecordCommand,
|
|
38
|
+
}
|
|
39
|
+
/* @aws-sdk/client-kinesis Not a pure module */
|
package/src/Metadata.res
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** see: https://github.com/smithy-lang/smithy-typescript/blob/75e0125c8d25c4b1002f39d9d0fac7792acc3d43/packages/types/src/response.ts#L4 */
|
|
2
|
+
type t = {
|
|
3
|
+
attempts: int,
|
|
4
|
+
cfId: string,
|
|
5
|
+
extendedRequestId: string,
|
|
6
|
+
httpStatusCode: int,
|
|
7
|
+
requestId: string,
|
|
8
|
+
totalRetryDelay: int,
|
|
9
|
+
}
|
package/src/S3.res
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/*** aws-sdk/s3
|
|
2
|
+
see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html
|
|
3
|
+
*/
|
|
4
|
+
type client
|
|
5
|
+
|
|
6
|
+
let clientInstance = ref(None)
|
|
7
|
+
|
|
8
|
+
module Raw = {
|
|
9
|
+
type options // TODO: implement
|
|
10
|
+
@module("@aws-sdk/client-s3") @new external client: (~options: options=?, unit) => client = "S3"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let client = () =>
|
|
14
|
+
switch clientInstance.contents {
|
|
15
|
+
| None =>
|
|
16
|
+
let client = Raw.client()
|
|
17
|
+
clientInstance := Some(client)
|
|
18
|
+
client
|
|
19
|
+
| Some(client) => client
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module GetObjectCommand = {
|
|
23
|
+
type t
|
|
24
|
+
|
|
25
|
+
type input = {
|
|
26
|
+
@as("Bucket") bucket: string,
|
|
27
|
+
@as("Key") key: string,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type output = {
|
|
31
|
+
/** readable stream of the object */
|
|
32
|
+
@as("Body")
|
|
33
|
+
body: NodeStreams.Readable.t,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@new @module("@aws-sdk/client-s3")
|
|
37
|
+
external make: input => t = "GetObjectCommand"
|
|
38
|
+
|
|
39
|
+
module Raw = {
|
|
40
|
+
@send
|
|
41
|
+
external send: (client, t) => promise<output> = "send"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let send: t => promise<output> = input => Raw.send(client(), input)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module PutObjectCommand = {
|
|
48
|
+
type t
|
|
49
|
+
|
|
50
|
+
type body //= String(string) | Stream(NodeStreams.Readable.t) // not implemented options: Buffer, Uint8Array
|
|
51
|
+
external bodyFromString: string => body = "%identity"
|
|
52
|
+
external bodyFromReadableStream: NodeStreams.Readable.t => body = "%identity"
|
|
53
|
+
|
|
54
|
+
type input = {
|
|
55
|
+
@as("Bucket")
|
|
56
|
+
bucket: string,
|
|
57
|
+
@as("Key")
|
|
58
|
+
key: string,
|
|
59
|
+
@as("Body")
|
|
60
|
+
body: body,
|
|
61
|
+
@as("ContentLength") contentLength?: int,
|
|
62
|
+
@as("ContentType") contentType?: string,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type output = {@as("ETag") eTag: string, @as("VersionId") versionId: string}
|
|
66
|
+
|
|
67
|
+
@new @module("@aws-sdk/client-s3")
|
|
68
|
+
external make: input => t = "PutObjectCommand"
|
|
69
|
+
|
|
70
|
+
module Raw = {
|
|
71
|
+
@send
|
|
72
|
+
external send: (client, t) => promise<output> = "send"
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let send: t => promise<output> = input => Raw.send(client(), input)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module CompleteMultipartUploadCommand = {
|
|
79
|
+
type t
|
|
80
|
+
type completedPart = {
|
|
81
|
+
@as("ChecksumCRC32") checksumCRC32?: string,
|
|
82
|
+
@as("ChecksumCRC32C") checksumCRC32C?: string,
|
|
83
|
+
@as("ChecksumSHA1") checksumSHA1?: string,
|
|
84
|
+
@as("ChecksumSHA256") checksumSHA256?: string,
|
|
85
|
+
@as("ETag") eTag: string,
|
|
86
|
+
/** positive integer between 1 and 10,000 */
|
|
87
|
+
@as("PartNumber")
|
|
88
|
+
partNumber: int,
|
|
89
|
+
}
|
|
90
|
+
type completeMultipartUpload = {@as("Parts") parts: array<completedPart>} //list({@as("ETag") eTag: string, @as("PartNumber") partNumber: int})
|
|
91
|
+
type requestPayer = [#requester]
|
|
92
|
+
type input = {
|
|
93
|
+
@as("Bucket") bucket: string,
|
|
94
|
+
@as("Key") key: string,
|
|
95
|
+
@as("UploadId") uploadId: string,
|
|
96
|
+
@as("ChecksumCRC32") checksumCRC32?: string,
|
|
97
|
+
@as("ChecksumCRC32C") checksumCRC32C?: string,
|
|
98
|
+
@as("ChecksumSHA1") checksumSHA1?: string,
|
|
99
|
+
@as("ChecksumSHA256") checksumSHA256?: string,
|
|
100
|
+
@as("ExpectedBucketOwner")
|
|
101
|
+
expectedBucketOwner?: string,
|
|
102
|
+
/** expects `"*"` */
|
|
103
|
+
@as("IfNoneMatch")
|
|
104
|
+
ifNoneMatch?: string,
|
|
105
|
+
@as("MultipartUpload") multipartUpload: completeMultipartUpload,
|
|
106
|
+
@as("RequestPayer") requestPayer?: requestPayer,
|
|
107
|
+
@as("SSECustomerAlgorithm") sseCustomerAlgorithm?: string, // TODO: ensure only valid values can be passed
|
|
108
|
+
@as("SSECustomerKey") sseCustomerKey?: string,
|
|
109
|
+
@as("SSECustomerKeyMD5") sseCustomerKeyMD5?: string,
|
|
110
|
+
}
|
|
111
|
+
type output = {
|
|
112
|
+
@as("Bucket") bucket: string,
|
|
113
|
+
@as("BucketKeyEnabled") bucketKeyEnabled: bool,
|
|
114
|
+
@as("ChecksumCRC32") checksumCRC32?: string,
|
|
115
|
+
@as("ChecksumCRC32C") checksumCRC32C?: string,
|
|
116
|
+
@as("ChecksumSHA1") checksumSHA1?: string,
|
|
117
|
+
@as("ChecksumSHA256") checksumSHA256?: string,
|
|
118
|
+
@as("ETag") eTag: string,
|
|
119
|
+
@as("Expiration") expiration?: string,
|
|
120
|
+
@as("Key") key: string,
|
|
121
|
+
@as("Location") location: string,
|
|
122
|
+
@as("RequestCharged") requestCharged?: string,
|
|
123
|
+
@as("SSEKMSKeyId") sseKMSKeyId?: string,
|
|
124
|
+
@as("ServerSideEncryption") serverSideEncryption?: string,
|
|
125
|
+
@as("VersionId") versionId?: string,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@new @module("@aws-sdk/client-s3")
|
|
129
|
+
external make: input => t = "CompleteMultipartUploadCommand"
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
module Upload = {
|
|
133
|
+
type t
|
|
134
|
+
|
|
135
|
+
module Raw = {
|
|
136
|
+
type options = {
|
|
137
|
+
leavePartsOnError?: bool,
|
|
138
|
+
partSize?: int,
|
|
139
|
+
queueSize?: int,
|
|
140
|
+
tags?: array<dict<string>>, // NOTE: not sure if this type is correct
|
|
141
|
+
// TODO: abortController?: Node.AbortController.t // There are no bindings for AbortController yet!
|
|
142
|
+
client: client,
|
|
143
|
+
params: PutObjectCommand.input,
|
|
144
|
+
}
|
|
145
|
+
@new @module("@aws-sdk/lib-storage")
|
|
146
|
+
external make: options => t = "Upload"
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
type done = promise<CompleteMultipartUploadCommand.output>
|
|
150
|
+
@send
|
|
151
|
+
external done: t => done = "done"
|
|
152
|
+
}
|
package/src/S3.res.mjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
4
|
+
import * as ClientS3 from "@aws-sdk/client-s3";
|
|
5
|
+
|
|
6
|
+
let clientInstance = {
|
|
7
|
+
contents: undefined
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let Raw = {};
|
|
11
|
+
|
|
12
|
+
function client() {
|
|
13
|
+
let client$1 = clientInstance.contents;
|
|
14
|
+
if (client$1 !== undefined) {
|
|
15
|
+
return Primitive_option.valFromOption(client$1);
|
|
16
|
+
}
|
|
17
|
+
let client$2 = new ClientS3.S3(undefined);
|
|
18
|
+
clientInstance.contents = Primitive_option.some(client$2);
|
|
19
|
+
return client$2;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let Raw$1 = {};
|
|
23
|
+
|
|
24
|
+
function send(input) {
|
|
25
|
+
return client().send(input);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let GetObjectCommand = {
|
|
29
|
+
Raw: Raw$1,
|
|
30
|
+
send: send
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
let Raw$2 = {};
|
|
34
|
+
|
|
35
|
+
function send$1(input) {
|
|
36
|
+
return client().send(input);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let PutObjectCommand = {
|
|
40
|
+
Raw: Raw$2,
|
|
41
|
+
send: send$1
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
let CompleteMultipartUploadCommand = {};
|
|
45
|
+
|
|
46
|
+
let Raw$3 = {};
|
|
47
|
+
|
|
48
|
+
let Upload = {
|
|
49
|
+
Raw: Raw$3
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
clientInstance,
|
|
54
|
+
Raw,
|
|
55
|
+
client,
|
|
56
|
+
GetObjectCommand,
|
|
57
|
+
PutObjectCommand,
|
|
58
|
+
CompleteMultipartUploadCommand,
|
|
59
|
+
Upload,
|
|
60
|
+
}
|
|
61
|
+
/* @aws-sdk/client-s3 Not a pure module */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type uploadOptions = {
|
|
2
|
+
leavePartsOnError?: bool,
|
|
3
|
+
partSize?: int,
|
|
4
|
+
queueSize?: int,
|
|
5
|
+
tags?: array<dict<string>>,
|
|
6
|
+
client?: S3.client,
|
|
7
|
+
params: S3.PutObjectCommand.input,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let uploadMake = (options: uploadOptions): S3.Upload.t =>
|
|
11
|
+
S3.Upload.Raw.make({
|
|
12
|
+
leavePartsOnError: ?options.leavePartsOnError,
|
|
13
|
+
partSize: ?options.partSize,
|
|
14
|
+
queueSize: ?options.queueSize,
|
|
15
|
+
tags: ?options.tags,
|
|
16
|
+
client: options.client->Option.getOr(S3.client()),
|
|
17
|
+
params: options.params,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
let upload = (options: uploadOptions): S3.Upload.done => uploadMake(options)->S3.Upload.done
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S3$AwsSdk from "./S3.res.mjs";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as LibStorage from "@aws-sdk/lib-storage";
|
|
6
|
+
|
|
7
|
+
function uploadMake(options) {
|
|
8
|
+
return new LibStorage.Upload({
|
|
9
|
+
leavePartsOnError: options.leavePartsOnError,
|
|
10
|
+
partSize: options.partSize,
|
|
11
|
+
queueSize: options.queueSize,
|
|
12
|
+
tags: options.tags,
|
|
13
|
+
client: Stdlib_Option.getOr(options.client, S3$AwsSdk.client()),
|
|
14
|
+
params: options.params
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function upload(options) {
|
|
19
|
+
return uploadMake(options).done();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
uploadMake,
|
|
24
|
+
upload,
|
|
25
|
+
}
|
|
26
|
+
/* S3-AwsSdk Not a pure module */
|