-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistObjectsV2.ts
More file actions
62 lines (53 loc) · 1.98 KB
/
listObjectsV2.ts
File metadata and controls
62 lines (53 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import {
ListObjectsV2Command,
ListObjectsV2CommandInput,
ListObjectsV2CommandOutput,
OptionalObjectAttributes,
_Object,
} from '@aws-sdk/client-s3';
import {
extendCommandWithExtraParametersMiddleware,
overrideObjectAttributesHeaderMiddleware,
captureResponseBodyMiddleware,
parseListObjectsUserMetadataMiddleware,
} from './utils';
export interface ListObjectsV2ExtendedInput extends ListObjectsV2CommandInput {
Query?: string;
ObjectAttributes?: (OptionalObjectAttributes | `x-amz-meta-${string}`)[];
}
export interface ListObjectsV2ExtendedContentEntry extends _Object {
[key: `x-amz-meta-${string}`]: string;
}
export interface ListObjectsV2ExtendedOutput extends ListObjectsV2CommandOutput {
Contents?: ListObjectsV2ExtendedContentEntry[];
}
export class ListObjectsV2ExtendedCommand extends ListObjectsV2Command {
constructor(input: ListObjectsV2ExtendedInput) {
super(input);
if (input.Query) {
this.middlewareStack.add(
extendCommandWithExtraParametersMiddleware(input.Query),
{ step: 'build', name: 'extendCommandWithExtraParameters' }
);
}
if (input.ObjectAttributes?.length) {
const captured = { xml: '' };
this.middlewareStack.add(
overrideObjectAttributesHeaderMiddleware(
'x-amz-optional-object-attributes', input.ObjectAttributes), {
step: 'build',
name: 'overrideObjectAttributesHeader',
});
this.middlewareStack.add(captureResponseBodyMiddleware(captured), {
step: 'deserialize',
name: 'captureResponseBody',
priority: 'low',
});
this.middlewareStack.add(parseListObjectsUserMetadataMiddleware(captured), {
step: 'deserialize',
name: 'parseUserMetadata',
priority: 'high',
});
}
}
}