@scality/data-browser-library 1.0.0-preview.11
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/dist/components/Editor.d.ts +12 -0
- package/dist/components/Editor.js +28 -0
- package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCreate.test.js +408 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +618 -0
- package/dist/components/__tests__/BucketLifecycleList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketLifecycleList.test.js +325 -0
- package/dist/components/__tests__/BucketList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketList.test.js +415 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +316 -0
- package/dist/components/__tests__/BucketOverview.test.d.ts +1 -0
- package/dist/components/__tests__/BucketOverview.test.js +769 -0
- package/dist/components/__tests__/BucketPolicyPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketPolicyPage.test.js +268 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +1757 -0
- package/dist/components/__tests__/BucketReplicationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketReplicationList.test.js +344 -0
- package/dist/components/__tests__/CreateFolderButton.test.d.ts +1 -0
- package/dist/components/__tests__/CreateFolderButton.test.js +147 -0
- package/dist/components/__tests__/DeleteBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketButton.test.js +272 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
- package/dist/components/__tests__/DeleteObjectButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteObjectButton.test.js +302 -0
- package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
- package/dist/components/__tests__/MetadataSearch.test.d.ts +1 -0
- package/dist/components/__tests__/MetadataSearch.test.js +201 -0
- package/dist/components/__tests__/ObjectList.test.d.ts +1 -0
- package/dist/components/__tests__/ObjectList.test.js +283 -0
- package/dist/components/__tests__/UploadButton.test.d.ts +1 -0
- package/dist/components/__tests__/UploadButton.test.js +144 -0
- package/dist/components/buckets/BucketCreate.d.ts +49 -0
- package/dist/components/buckets/BucketCreate.js +237 -0
- package/dist/components/buckets/BucketDetails.d.ts +1 -0
- package/dist/components/buckets/BucketDetails.js +106 -0
- package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
- package/dist/components/buckets/BucketLifecycleFormPage.js +1085 -0
- package/dist/components/buckets/BucketLifecycleList.d.ts +10 -0
- package/dist/components/buckets/BucketLifecycleList.js +270 -0
- package/dist/components/buckets/BucketList.d.ts +15 -0
- package/dist/components/buckets/BucketList.js +146 -0
- package/dist/components/buckets/BucketLocation.d.ts +3 -0
- package/dist/components/buckets/BucketLocation.js +16 -0
- package/dist/components/buckets/BucketOverview.d.ts +88 -0
- package/dist/components/buckets/BucketOverview.js +291 -0
- package/dist/components/buckets/BucketPage.d.ts +2 -0
- package/dist/components/buckets/BucketPage.js +47 -0
- package/dist/components/buckets/BucketPolicyButton.d.ts +7 -0
- package/dist/components/buckets/BucketPolicyButton.js +18 -0
- package/dist/components/buckets/BucketPolicyPage.d.ts +1 -0
- package/dist/components/buckets/BucketPolicyPage.js +236 -0
- package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
- package/dist/components/buckets/BucketReplicationFormPage.js +834 -0
- package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
- package/dist/components/buckets/BucketReplicationList.js +189 -0
- package/dist/components/buckets/BucketVersioning.d.ts +4 -0
- package/dist/components/buckets/BucketVersioning.js +73 -0
- package/dist/components/buckets/DeleteBucketButton.d.ts +8 -0
- package/dist/components/buckets/DeleteBucketButton.js +78 -0
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +18 -0
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +53 -0
- package/dist/components/buckets/EmptyBucketButton.d.ts +5 -0
- package/dist/components/buckets/EmptyBucketButton.js +232 -0
- package/dist/components/buckets/EmptyBucketSummary.d.ts +9 -0
- package/dist/components/buckets/EmptyBucketSummary.js +60 -0
- package/dist/components/buckets/EmptyBucketSummaryList.d.ts +13 -0
- package/dist/components/buckets/EmptyBucketSummaryList.js +140 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +234 -0
- package/dist/components/buckets/notifications/EventsSection.d.ts +1 -0
- package/dist/components/buckets/notifications/EventsSection.js +123 -0
- package/dist/components/buckets/notifications/events.d.ts +12 -0
- package/dist/components/buckets/notifications/events.js +27 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/index.js +22 -0
- package/dist/components/layouts/ArrowNavigation.d.ts +4 -0
- package/dist/components/layouts/ArrowNavigation.js +16 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +12 -0
- package/dist/components/layouts/BrowserPageLayout.js +51 -0
- package/dist/components/objects/CreateFolderButton.d.ts +29 -0
- package/dist/components/objects/CreateFolderButton.js +118 -0
- package/dist/components/objects/DeleteObjectButton.d.ts +8 -0
- package/dist/components/objects/DeleteObjectButton.js +191 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +356 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +241 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.js +272 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +9 -0
- package/dist/components/objects/ObjectDetails/index.js +75 -0
- package/dist/components/objects/ObjectList.d.ts +40 -0
- package/dist/components/objects/ObjectList.js +453 -0
- package/dist/components/objects/ObjectLock/EditRetentionButton.d.ts +4 -0
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +32 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.d.ts +3 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +211 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +9 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +158 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +8 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +39 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +204 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +374 -0
- package/dist/components/objects/ObjectPage.d.ts +1 -0
- package/dist/components/objects/ObjectPage.js +45 -0
- package/dist/components/objects/UploadButton.d.ts +34 -0
- package/dist/components/objects/UploadButton.js +229 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +20 -0
- package/dist/components/providers/DataBrowserProvider.js +42 -0
- package/dist/components/search/MetadataSearch.d.ts +5 -0
- package/dist/components/search/MetadataSearch.js +162 -0
- package/dist/components/search/SearchHints.d.ts +8 -0
- package/dist/components/search/SearchHints.js +21 -0
- package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
- package/dist/components/ui/ArrayFieldActions.js +43 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
- package/dist/components/ui/DeleteObjectModalContent.d.ts +5 -0
- package/dist/components/ui/DeleteObjectModalContent.js +71 -0
- package/dist/components/ui/FilterFormSection.d.ts +44 -0
- package/dist/components/ui/FilterFormSection.js +159 -0
- package/dist/components/ui/Search.elements.d.ts +17 -0
- package/dist/components/ui/Search.elements.js +59 -0
- package/dist/components/ui/Table.elements.d.ts +36 -0
- package/dist/components/ui/Table.elements.js +87 -0
- package/dist/config/factory.d.ts +63 -0
- package/dist/config/factory.js +74 -0
- package/dist/config/types.d.ts +46 -0
- package/dist/config/types.js +0 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.d.ts +1 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +122 -0
- package/dist/hooks/bucketConfiguration.d.ts +168 -0
- package/dist/hooks/bucketConfiguration.js +67 -0
- package/dist/hooks/bucketOperations.d.ts +36 -0
- package/dist/hooks/bucketOperations.js +12 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +276 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +259 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +166 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +200 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +179 -0
- package/dist/hooks/factories/index.d.ts +18 -0
- package/dist/hooks/factories/index.js +5 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +13 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +76 -0
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +8 -0
- package/dist/hooks/factories/useCreateS3LoginHook.js +22 -0
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +5 -0
- package/dist/hooks/factories/useCreateS3MutationHook.js +50 -0
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +3 -0
- package/dist/hooks/factories/useCreateS3QueryHook.js +51 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/loginOperations.d.ts +21 -0
- package/dist/hooks/loginOperations.js +9 -0
- package/dist/hooks/objectOperations.d.ts +190 -0
- package/dist/hooks/objectOperations.js +67 -0
- package/dist/hooks/presignedOperations.d.ts +73 -0
- package/dist/hooks/presignedOperations.js +72 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +45 -0
- package/dist/hooks/useDeleteBucketConfigRule.d.ts +26 -0
- package/dist/hooks/useDeleteBucketConfigRule.js +46 -0
- package/dist/hooks/useEmptyBucket.d.ts +27 -0
- package/dist/hooks/useEmptyBucket.js +116 -0
- package/dist/hooks/useISVBucketDetection.d.ts +15 -0
- package/dist/hooks/useISVBucketDetection.js +27 -0
- package/dist/hooks/useIsBucketEmpty.d.ts +7 -0
- package/dist/hooks/useIsBucketEmpty.js +36 -0
- package/dist/hooks/useLoginMutation.d.ts +21 -0
- package/dist/hooks/useLoginMutation.js +9 -0
- package/dist/hooks/useS3Client.d.ts +1 -0
- package/dist/hooks/useS3Client.js +13 -0
- package/dist/hooks/useTableRowSelection.d.ts +9 -0
- package/dist/hooks/useTableRowSelection.js +45 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/schemas/bucketPolicySchema.json +321 -0
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -0
- package/dist/test/msw/handlers/deleteBucket.js +14 -0
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketAcl.js +96 -0
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketLocation.js +23 -0
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +11 -0
- package/dist/test/msw/handlers/getBucketPolicy.js +72 -0
- package/dist/test/msw/handlers/headObject.d.ts +1 -0
- package/dist/test/msw/handlers/headObject.js +17 -0
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -0
- package/dist/test/msw/handlers/listBuckets.js +24 -0
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -0
- package/dist/test/msw/handlers/listObjectVersions.js +83 -0
- package/dist/test/msw/handlers/listObjects.d.ts +1 -0
- package/dist/test/msw/handlers/listObjects.js +66 -0
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -0
- package/dist/test/msw/handlers/objectLegalHold.js +24 -0
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -0
- package/dist/test/msw/handlers/objectRetention.js +27 -0
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/putBucketAcl.js +18 -0
- package/dist/test/msw/handlers/putObject.d.ts +1 -0
- package/dist/test/msw/handlers/putObject.js +16 -0
- package/dist/test/msw/handlers.d.ts +4 -0
- package/dist/test/msw/handlers.js +109 -0
- package/dist/test/msw/index.d.ts +2 -0
- package/dist/test/msw/index.js +3 -0
- package/dist/test/msw/server.d.ts +4 -0
- package/dist/test/msw/server.js +20 -0
- package/dist/test/msw/utils.d.ts +2 -0
- package/dist/test/msw/utils.js +13 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +90 -0
- package/dist/test/testUtils.d.ts +181 -0
- package/dist/test/testUtils.js +310 -0
- package/dist/test/utils/errorHandling.test.d.ts +1 -0
- package/dist/test/utils/errorHandling.test.js +423 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/constants.d.ts +12 -0
- package/dist/utils/constants.js +9 -0
- package/dist/utils/deletion/index.d.ts +2 -0
- package/dist/utils/deletion/index.js +2 -0
- package/dist/utils/deletion/messages.d.ts +5 -0
- package/dist/utils/deletion/messages.js +29 -0
- package/dist/utils/deletion/types.d.ts +11 -0
- package/dist/utils/deletion/types.js +0 -0
- package/dist/utils/errorHandling.d.ts +63 -0
- package/dist/utils/errorHandling.js +84 -0
- package/dist/utils/hooks.d.ts +2 -0
- package/dist/utils/hooks.js +26 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/proxyMiddleware.d.ts +18 -0
- package/dist/utils/proxyMiddleware.js +56 -0
- package/dist/utils/s3Client.d.ts +5 -0
- package/dist/utils/s3Client.js +36 -0
- package/dist/utils/s3RuleUtils.d.ts +53 -0
- package/dist/utils/s3RuleUtils.js +101 -0
- package/dist/utils/useFeatures.d.ts +1 -0
- package/dist/utils/useFeatures.js +7 -0
- package/package.json +84 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "AWS S3 Bucket Policy",
|
|
4
|
+
"description": "JSON Schema for AWS S3 Bucket Policy documents",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["Version", "Statement"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"Version": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["2012-10-17", "2008-10-17"],
|
|
11
|
+
"description": "The policy language version. Use '2012-10-17' for current policies."
|
|
12
|
+
},
|
|
13
|
+
"Id": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Optional identifier for the policy"
|
|
16
|
+
},
|
|
17
|
+
"Statement": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"minItems": 1,
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"required": ["Effect"],
|
|
23
|
+
"oneOf": [
|
|
24
|
+
{ "required": ["Principal"] },
|
|
25
|
+
{ "required": ["NotPrincipal"] }
|
|
26
|
+
],
|
|
27
|
+
"properties": {
|
|
28
|
+
"Sid": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"pattern": "^[a-zA-Z0-9]+$",
|
|
31
|
+
"description": "Optional statement ID for identifying the statement (alphanumeric only)"
|
|
32
|
+
},
|
|
33
|
+
"Effect": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": ["Allow", "Deny"],
|
|
36
|
+
"description": "Whether to allow or deny the actions"
|
|
37
|
+
},
|
|
38
|
+
"Principal": {
|
|
39
|
+
"oneOf": [
|
|
40
|
+
{
|
|
41
|
+
"type": "string",
|
|
42
|
+
"enum": ["*"],
|
|
43
|
+
"description": "All principals (public access)"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "object",
|
|
47
|
+
"description": "Specific principals",
|
|
48
|
+
"minProperties": 1,
|
|
49
|
+
"properties": {
|
|
50
|
+
"AWS": {
|
|
51
|
+
"oneOf": [
|
|
52
|
+
{
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "AWS account, IAM user, or role ARN"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"type": "array",
|
|
58
|
+
"minItems": 1,
|
|
59
|
+
"items": { "type": "string" },
|
|
60
|
+
"description": "List of AWS accounts, IAM users, or role ARNs"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"Service": {
|
|
65
|
+
"oneOf": [
|
|
66
|
+
{
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "AWS service principal (e.g., 's3.amazonaws.com')"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "array",
|
|
72
|
+
"minItems": 1,
|
|
73
|
+
"items": { "type": "string" },
|
|
74
|
+
"description": "List of AWS service principals"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"Federated": {
|
|
79
|
+
"oneOf": [
|
|
80
|
+
{
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "Federated identity provider ARN"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "array",
|
|
86
|
+
"minItems": 1,
|
|
87
|
+
"items": { "type": "string" },
|
|
88
|
+
"description": "List of federated identity provider ARNs"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"CanonicalUser": {
|
|
93
|
+
"oneOf": [
|
|
94
|
+
{
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Canonical user ID"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "array",
|
|
100
|
+
"minItems": 1,
|
|
101
|
+
"items": { "type": "string" },
|
|
102
|
+
"description": "List of canonical user IDs"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"additionalProperties": false
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"description": "The principal that is allowed or denied access"
|
|
111
|
+
},
|
|
112
|
+
"NotPrincipal": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"description": "All principals EXCEPT those specified",
|
|
115
|
+
"minProperties": 1,
|
|
116
|
+
"properties": {
|
|
117
|
+
"AWS": {
|
|
118
|
+
"oneOf": [
|
|
119
|
+
{
|
|
120
|
+
"type": "string",
|
|
121
|
+
"description": "AWS account, IAM user, or role ARN"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "array",
|
|
125
|
+
"minItems": 1,
|
|
126
|
+
"items": { "type": "string" },
|
|
127
|
+
"description": "List of AWS accounts, IAM users, or role ARNs"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"Service": {
|
|
132
|
+
"oneOf": [
|
|
133
|
+
{
|
|
134
|
+
"type": "string",
|
|
135
|
+
"description": "AWS service principal (e.g., 's3.amazonaws.com')"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "array",
|
|
139
|
+
"minItems": 1,
|
|
140
|
+
"items": { "type": "string" },
|
|
141
|
+
"description": "List of AWS service principals"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"Federated": {
|
|
146
|
+
"oneOf": [
|
|
147
|
+
{
|
|
148
|
+
"type": "string",
|
|
149
|
+
"description": "Federated identity provider ARN"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "array",
|
|
153
|
+
"minItems": 1,
|
|
154
|
+
"items": { "type": "string" },
|
|
155
|
+
"description": "List of federated identity provider ARNs"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"CanonicalUser": {
|
|
160
|
+
"oneOf": [
|
|
161
|
+
{
|
|
162
|
+
"type": "string",
|
|
163
|
+
"description": "Canonical user ID"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"type": "array",
|
|
167
|
+
"minItems": 1,
|
|
168
|
+
"items": { "type": "string" },
|
|
169
|
+
"description": "List of canonical user IDs"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"additionalProperties": false
|
|
175
|
+
},
|
|
176
|
+
"Action": {
|
|
177
|
+
"oneOf": [
|
|
178
|
+
{
|
|
179
|
+
"type": "string",
|
|
180
|
+
"description": "Single action or action with wildcards (e.g., 's3:GetObject', 's3:*')"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"type": "array",
|
|
184
|
+
"minItems": 1,
|
|
185
|
+
"items": { "type": "string" },
|
|
186
|
+
"description": "List of actions"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"description": "The actions that are allowed or denied"
|
|
190
|
+
},
|
|
191
|
+
"NotAction": {
|
|
192
|
+
"oneOf": [
|
|
193
|
+
{
|
|
194
|
+
"type": "string",
|
|
195
|
+
"description": "Single action to exclude"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"type": "array",
|
|
199
|
+
"minItems": 1,
|
|
200
|
+
"items": { "type": "string" },
|
|
201
|
+
"description": "List of actions to exclude"
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"description": "All actions EXCEPT those specified"
|
|
205
|
+
},
|
|
206
|
+
"Resource": {
|
|
207
|
+
"oneOf": [
|
|
208
|
+
{
|
|
209
|
+
"type": "string",
|
|
210
|
+
"description": "Single resource ARN (e.g., 'arn:aws:s3:::bucket/*')"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"type": "array",
|
|
214
|
+
"minItems": 1,
|
|
215
|
+
"items": { "type": "string" },
|
|
216
|
+
"description": "List of resource ARNs"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"description": "The resources to which the actions apply"
|
|
220
|
+
},
|
|
221
|
+
"NotResource": {
|
|
222
|
+
"oneOf": [
|
|
223
|
+
{
|
|
224
|
+
"type": "string",
|
|
225
|
+
"description": "Single resource ARN to exclude"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"type": "array",
|
|
229
|
+
"minItems": 1,
|
|
230
|
+
"items": { "type": "string" },
|
|
231
|
+
"description": "List of resource ARNs to exclude"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"description": "All resources EXCEPT those specified"
|
|
235
|
+
},
|
|
236
|
+
"Condition": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"description": "Optional conditions for when the policy is in effect",
|
|
239
|
+
"properties": {
|
|
240
|
+
"StringEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
241
|
+
"StringNotEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
242
|
+
"StringEqualsIgnoreCase": { "$ref": "#/$defs/conditionBlock" },
|
|
243
|
+
"StringNotEqualsIgnoreCase": { "$ref": "#/$defs/conditionBlock" },
|
|
244
|
+
"StringLike": { "$ref": "#/$defs/conditionBlock" },
|
|
245
|
+
"StringNotLike": { "$ref": "#/$defs/conditionBlock" },
|
|
246
|
+
"NumericEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
247
|
+
"NumericNotEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
248
|
+
"NumericLessThan": { "$ref": "#/$defs/conditionBlock" },
|
|
249
|
+
"NumericLessThanEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
250
|
+
"NumericGreaterThan": { "$ref": "#/$defs/conditionBlock" },
|
|
251
|
+
"NumericGreaterThanEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
252
|
+
"DateEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
253
|
+
"DateNotEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
254
|
+
"DateLessThan": { "$ref": "#/$defs/conditionBlock" },
|
|
255
|
+
"DateLessThanEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
256
|
+
"DateGreaterThan": { "$ref": "#/$defs/conditionBlock" },
|
|
257
|
+
"DateGreaterThanEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
258
|
+
"Bool": { "$ref": "#/$defs/conditionBlock" },
|
|
259
|
+
"BinaryEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
260
|
+
"IpAddress": { "$ref": "#/$defs/conditionBlock" },
|
|
261
|
+
"NotIpAddress": { "$ref": "#/$defs/conditionBlock" },
|
|
262
|
+
"ArnEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
263
|
+
"ArnNotEquals": { "$ref": "#/$defs/conditionBlock" },
|
|
264
|
+
"ArnLike": { "$ref": "#/$defs/conditionBlock" },
|
|
265
|
+
"ArnNotLike": { "$ref": "#/$defs/conditionBlock" },
|
|
266
|
+
"Null": { "$ref": "#/$defs/conditionBlock" }
|
|
267
|
+
},
|
|
268
|
+
"additionalProperties": {
|
|
269
|
+
"$ref": "#/$defs/conditionBlock"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"additionalProperties": false,
|
|
274
|
+
"allOf": [
|
|
275
|
+
{
|
|
276
|
+
"oneOf": [{ "required": ["Action"] }, { "required": ["NotAction"] }]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"oneOf": [
|
|
280
|
+
{ "required": ["Resource"] },
|
|
281
|
+
{ "required": ["NotResource"] }
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"$defs": {
|
|
289
|
+
"conditionBlock": {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"description": "Key-value pairs for condition evaluation",
|
|
292
|
+
"additionalProperties": {
|
|
293
|
+
"oneOf": [
|
|
294
|
+
{
|
|
295
|
+
"type": "string",
|
|
296
|
+
"description": "Single condition value"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"type": "number",
|
|
300
|
+
"description": "Numeric condition value"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"type": "boolean",
|
|
304
|
+
"description": "Boolean condition value"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"type": "array",
|
|
308
|
+
"items": {
|
|
309
|
+
"oneOf": [
|
|
310
|
+
{ "type": "string" },
|
|
311
|
+
{ "type": "number" },
|
|
312
|
+
{ "type": "boolean" }
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
"description": "Multiple condition values"
|
|
316
|
+
}
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const deleteBucketHandler: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { rest } from "msw";
|
|
2
|
+
import { createS3ErrorXml, getS3BaseUrl } from "../utils.js";
|
|
3
|
+
const deleteBucketHandler = rest["delete"](`${getS3BaseUrl()}/:bucketName`, (req, res, ctx)=>{
|
|
4
|
+
const { bucketName } = req.params;
|
|
5
|
+
if ("string" == typeof bucketName) {
|
|
6
|
+
if (bucketName.includes("non-existent-bucket")) return res(ctx.status(404), ctx.xml(createS3ErrorXml("NoSuchBucket", "The specified bucket does not exist", bucketName)));
|
|
7
|
+
if (bucketName.includes("bucket-not-empty")) return res(ctx.status(409), ctx.xml(createS3ErrorXml("BucketNotEmpty", "The bucket you tried to delete is not empty", bucketName)));
|
|
8
|
+
if (bucketName.includes("restricted-bucket")) return res(ctx.status(403), ctx.xml(createS3ErrorXml("AccessDenied", "Access Denied")));
|
|
9
|
+
if (bucketName.includes("network-error-bucket")) return res.networkError("Failed to connect");
|
|
10
|
+
if (bucketName.includes("error-callback-bucket")) return res(ctx.status(500), ctx.xml(createS3ErrorXml("InternalError", "We encountered an internal error. Please try again.")));
|
|
11
|
+
}
|
|
12
|
+
return res(ctx.status(204));
|
|
13
|
+
});
|
|
14
|
+
export { deleteBucketHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBucketAclHandler: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { rest } from "msw";
|
|
2
|
+
import { createS3ErrorXml, getS3BaseUrl } from "../utils.js";
|
|
3
|
+
const getBucketAclHandler = rest.get(`${getS3BaseUrl()}/:bucketName`, (req, res, ctx)=>{
|
|
4
|
+
const { bucketName } = req.params;
|
|
5
|
+
const url = new URL(req.url);
|
|
6
|
+
if (!url.searchParams.has("acl")) return;
|
|
7
|
+
if ("string" == typeof bucketName) {
|
|
8
|
+
if (bucketName.includes("non-existent-bucket")) return res(ctx.status(404), ctx.xml(createS3ErrorXml("NoSuchBucket", "The specified bucket does not exist", bucketName)));
|
|
9
|
+
if (bucketName.includes("access-denied-bucket")) return res(ctx.status(403), ctx.xml(createS3ErrorXml("AccessDenied", "Access Denied")));
|
|
10
|
+
if (bucketName.includes("network-error-bucket")) return res.networkError("Failed to connect");
|
|
11
|
+
if (bucketName.includes("private-bucket")) return res(ctx.status(200), ctx.xml(`<?xml version="1.0" encoding="UTF-8"?>
|
|
12
|
+
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
13
|
+
<Owner>
|
|
14
|
+
<ID>owner-canonical-id-123</ID>
|
|
15
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
16
|
+
</Owner>
|
|
17
|
+
<AccessControlList>
|
|
18
|
+
<Grant>
|
|
19
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
|
20
|
+
<ID>owner-canonical-id-123</ID>
|
|
21
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
22
|
+
</Grantee>
|
|
23
|
+
<Permission>FULL_CONTROL</Permission>
|
|
24
|
+
</Grant>
|
|
25
|
+
</AccessControlList>
|
|
26
|
+
</AccessControlPolicy>`));
|
|
27
|
+
if (bucketName.includes("public-read-bucket")) return res(ctx.status(200), ctx.xml(`<?xml version="1.0" encoding="UTF-8"?>
|
|
28
|
+
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
29
|
+
<Owner>
|
|
30
|
+
<ID>owner-canonical-id-123</ID>
|
|
31
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
32
|
+
</Owner>
|
|
33
|
+
<AccessControlList>
|
|
34
|
+
<Grant>
|
|
35
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
|
36
|
+
<ID>owner-canonical-id-123</ID>
|
|
37
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
38
|
+
</Grantee>
|
|
39
|
+
<Permission>FULL_CONTROL</Permission>
|
|
40
|
+
</Grant>
|
|
41
|
+
<Grant>
|
|
42
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
|
|
43
|
+
<URI>http://acs.amazonaws.com/groups/global/AllUsers</URI>
|
|
44
|
+
</Grantee>
|
|
45
|
+
<Permission>READ</Permission>
|
|
46
|
+
</Grant>
|
|
47
|
+
</AccessControlList>
|
|
48
|
+
</AccessControlPolicy>`));
|
|
49
|
+
if (bucketName.includes("shared-bucket")) return res(ctx.status(200), ctx.xml(`<?xml version="1.0" encoding="UTF-8"?>
|
|
50
|
+
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
51
|
+
<Owner>
|
|
52
|
+
<ID>owner-canonical-id-123</ID>
|
|
53
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
54
|
+
</Owner>
|
|
55
|
+
<AccessControlList>
|
|
56
|
+
<Grant>
|
|
57
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
|
58
|
+
<ID>owner-canonical-id-123</ID>
|
|
59
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
60
|
+
</Grantee>
|
|
61
|
+
<Permission>FULL_CONTROL</Permission>
|
|
62
|
+
</Grant>
|
|
63
|
+
<Grant>
|
|
64
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
|
65
|
+
<ID>user-canonical-id-456</ID>
|
|
66
|
+
<DisplayName>shared-user</DisplayName>
|
|
67
|
+
</Grantee>
|
|
68
|
+
<Permission>READ_WRITE</Permission>
|
|
69
|
+
</Grant>
|
|
70
|
+
<Grant>
|
|
71
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
|
|
72
|
+
<URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI>
|
|
73
|
+
</Grantee>
|
|
74
|
+
<Permission>READ</Permission>
|
|
75
|
+
</Grant>
|
|
76
|
+
</AccessControlList>
|
|
77
|
+
</AccessControlPolicy>`));
|
|
78
|
+
}
|
|
79
|
+
return res(ctx.status(200), ctx.xml(`<?xml version="1.0" encoding="UTF-8"?>
|
|
80
|
+
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
81
|
+
<Owner>
|
|
82
|
+
<ID>owner-canonical-id-123</ID>
|
|
83
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
84
|
+
</Owner>
|
|
85
|
+
<AccessControlList>
|
|
86
|
+
<Grant>
|
|
87
|
+
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
|
88
|
+
<ID>owner-canonical-id-123</ID>
|
|
89
|
+
<DisplayName>bucket-owner</DisplayName>
|
|
90
|
+
</Grantee>
|
|
91
|
+
<Permission>FULL_CONTROL</Permission>
|
|
92
|
+
</Grant>
|
|
93
|
+
</AccessControlList>
|
|
94
|
+
</AccessControlPolicy>`));
|
|
95
|
+
});
|
|
96
|
+
export { getBucketAclHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBucketLocationHandler: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { rest } from "msw";
|
|
2
|
+
import { createS3ErrorXml, getS3BaseUrl } from "../utils.js";
|
|
3
|
+
const getBucketLocationHandler = rest.get(`${getS3BaseUrl()}/:bucketName`, (req, res, ctx)=>{
|
|
4
|
+
const { bucketName } = req.params;
|
|
5
|
+
const url = new URL(req.url);
|
|
6
|
+
if (!url.searchParams.has("location")) return;
|
|
7
|
+
if ("string" == typeof bucketName) {
|
|
8
|
+
if (bucketName.includes("non-existent-bucket")) return res(ctx.status(404), ctx.xml(createS3ErrorXml("NoSuchBucket", "The specified bucket does not exist", bucketName)));
|
|
9
|
+
if (bucketName.includes("access-denied-bucket")) return res(ctx.status(403), ctx.xml(createS3ErrorXml("AccessDenied", "Access Denied")));
|
|
10
|
+
if (bucketName.includes("network-error-bucket")) return res.networkError("Failed to connect");
|
|
11
|
+
let locationConstraint = null;
|
|
12
|
+
if (bucketName.includes("eu-west-1")) locationConstraint = "eu-west-1";
|
|
13
|
+
else if (bucketName.includes("ap-southeast-1")) locationConstraint = "ap-southeast-1";
|
|
14
|
+
else if (bucketName.includes("us-west-2")) locationConstraint = "us-west-2";
|
|
15
|
+
const response = locationConstraint ? `<?xml version="1.0" encoding="UTF-8"?>
|
|
16
|
+
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">${locationConstraint}</LocationConstraint>` : `<?xml version="1.0" encoding="UTF-8"?>
|
|
17
|
+
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/"></LocationConstraint>`;
|
|
18
|
+
return res(ctx.status(200), ctx.set("Content-Type", "application/xml"), ctx.body(response));
|
|
19
|
+
}
|
|
20
|
+
return res(ctx.status(200), ctx.set("Content-Type", "application/xml"), ctx.body(`<?xml version="1.0" encoding="UTF-8"?>
|
|
21
|
+
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/"></LocationConstraint>`));
|
|
22
|
+
});
|
|
23
|
+
export { getBucketLocationHandler };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MSW handler for S3 GetBucketPolicy requests
|
|
3
|
+
*
|
|
4
|
+
* Simulates different bucket policy scenarios based on bucket naming patterns:
|
|
5
|
+
* - Buckets starting with "policy-" return sample policies
|
|
6
|
+
* - "no-policy-bucket" returns NoSuchBucketPolicy error
|
|
7
|
+
* - "access-denied-bucket" returns AccessDenied error
|
|
8
|
+
* - "invalid-json-bucket" returns malformed JSON for testing
|
|
9
|
+
* - Other buckets return a default allow-all policy
|
|
10
|
+
*/
|
|
11
|
+
export declare const getBucketPolicyHandler: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { rest } from "msw";
|
|
2
|
+
import { createS3ErrorXml, getS3BaseUrl } from "../utils.js";
|
|
3
|
+
const getBucketPolicyHandler = rest.get(`${getS3BaseUrl()}/:bucketName`, (req, res, ctx)=>{
|
|
4
|
+
const { bucketName } = req.params;
|
|
5
|
+
const url = new URL(req.url);
|
|
6
|
+
if (!url.searchParams.has("policy")) return;
|
|
7
|
+
if ("no-policy-bucket" === bucketName) return res(ctx.status(404), ctx.set("Content-Type", "application/xml"), ctx.body(createS3ErrorXml("NoSuchBucketPolicy", "The bucket policy does not exist", bucketName)));
|
|
8
|
+
if ("access-denied-bucket" === bucketName) return res(ctx.status(403), ctx.set("Content-Type", "application/xml"), ctx.body(createS3ErrorXml("AccessDenied", "Access Denied", bucketName)));
|
|
9
|
+
if ("invalid-json-bucket" === bucketName) return res(ctx.status(200), ctx.set("Content-Type", "application/json"), ctx.body('{"Version": "2012-10-17", "Statement": [invalid json}'));
|
|
10
|
+
let policy;
|
|
11
|
+
policy = "string" == typeof bucketName && bucketName.startsWith("policy-readonly-") ? {
|
|
12
|
+
Version: "2012-10-17",
|
|
13
|
+
Statement: [
|
|
14
|
+
{
|
|
15
|
+
Sid: "PublicReadGetObject",
|
|
16
|
+
Effect: "Allow",
|
|
17
|
+
Principal: "*",
|
|
18
|
+
Action: "s3:GetObject",
|
|
19
|
+
Resource: `arn:aws:s3:::${bucketName}/*`
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
} : "string" == typeof bucketName && bucketName.startsWith("policy-complex-") ? {
|
|
23
|
+
Version: "2012-10-17",
|
|
24
|
+
Statement: [
|
|
25
|
+
{
|
|
26
|
+
Sid: "AllowSpecificUser",
|
|
27
|
+
Effect: "Allow",
|
|
28
|
+
Principal: {
|
|
29
|
+
AWS: "arn:aws:iam::123456789012:user/ExampleUser"
|
|
30
|
+
},
|
|
31
|
+
Action: [
|
|
32
|
+
"s3:GetObject",
|
|
33
|
+
"s3:PutObject"
|
|
34
|
+
],
|
|
35
|
+
Resource: `arn:aws:s3:::${bucketName}/*`
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
Sid: "DenyInsecureConnections",
|
|
39
|
+
Effect: "Deny",
|
|
40
|
+
Principal: "*",
|
|
41
|
+
Action: "s3:*",
|
|
42
|
+
Resource: [
|
|
43
|
+
`arn:aws:s3:::${bucketName}`,
|
|
44
|
+
`arn:aws:s3:::${bucketName}/*`
|
|
45
|
+
],
|
|
46
|
+
Condition: {
|
|
47
|
+
Bool: {
|
|
48
|
+
"aws:SecureTransport": "false"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
} : {
|
|
54
|
+
Version: "2012-10-17",
|
|
55
|
+
Statement: [
|
|
56
|
+
{
|
|
57
|
+
Sid: "DefaultStatement",
|
|
58
|
+
Effect: "Allow",
|
|
59
|
+
Principal: {
|
|
60
|
+
AWS: "arn:aws:iam::123456789012:root"
|
|
61
|
+
},
|
|
62
|
+
Action: "s3:*",
|
|
63
|
+
Resource: [
|
|
64
|
+
`arn:aws:s3:::${bucketName}`,
|
|
65
|
+
`arn:aws:s3:::${bucketName}/*`
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
return res(ctx.status(200), ctx.set("Content-Type", "application/json"), ctx.body(JSON.stringify(policy)));
|
|
71
|
+
});
|
|
72
|
+
export { getBucketPolicyHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const headObjectHandler: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { rest } from "msw";
|
|
2
|
+
import { createS3ErrorXml, getS3BaseUrl } from "../utils.js";
|
|
3
|
+
const headObjectHandler = rest.head(`${getS3BaseUrl()}/:bucketName/*`, (req, res, ctx)=>{
|
|
4
|
+
const { bucketName } = req.params;
|
|
5
|
+
const url = new URL(req.url);
|
|
6
|
+
const objectKey = url.pathname.substring(url.pathname.indexOf("/", 1) + 1);
|
|
7
|
+
const versionId = url.searchParams.get("versionId");
|
|
8
|
+
if ("string" == typeof bucketName) {
|
|
9
|
+
if (bucketName.includes("non-existent-bucket")) return res(ctx.status(404), ctx.xml(createS3ErrorXml("NoSuchBucket", "The specified bucket does not exist", bucketName)));
|
|
10
|
+
if (objectKey.includes("non-existent-object")) return res(ctx.status(404), ctx.xml(createS3ErrorXml("NotFound", "The specified key does not exist.", bucketName, objectKey)));
|
|
11
|
+
if (bucketName.includes("restricted-bucket")) return res(ctx.status(403), ctx.xml(createS3ErrorXml("AccessDenied", "Access Denied")));
|
|
12
|
+
if (bucketName.includes("network-error-bucket")) return res.networkError("Failed to connect");
|
|
13
|
+
return res(ctx.status(200), ctx.set("x-amz-meta-custom-key", "custom-value"), ctx.set("Content-Length", "12345"), ctx.set("Content-Type", "application/octet-stream"), ctx.set("ETag", '"some-etag"'), ctx.set("Last-Modified", new Date().toUTCString()), ctx.set("x-amz-version-id", versionId || "some-version-id"));
|
|
14
|
+
}
|
|
15
|
+
return res(ctx.status(400), ctx.xml(createS3ErrorXml("InvalidArgument", "Invalid request parameters")));
|
|
16
|
+
});
|
|
17
|
+
export { headObjectHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listBucketsHandler: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { rest } from "msw";
|
|
2
|
+
import { getS3BaseUrl } from "../utils.js";
|
|
3
|
+
const listBucketsHandler = rest.get(`${getS3BaseUrl()}/`, (_req, res, ctx)=>res(ctx.status(200), ctx.xml(`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
|
+
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
5
|
+
<Owner>
|
|
6
|
+
<ID>owner-id-123</ID>
|
|
7
|
+
<DisplayName>Test Owner</DisplayName>
|
|
8
|
+
</Owner>
|
|
9
|
+
<Buckets>
|
|
10
|
+
<Bucket>
|
|
11
|
+
<Name>bucket-1</Name>
|
|
12
|
+
<CreationDate>2023-10-12T17:50:00.000Z</CreationDate>
|
|
13
|
+
</Bucket>
|
|
14
|
+
<Bucket>
|
|
15
|
+
<Name>bucket-2</Name>
|
|
16
|
+
<CreationDate>2023-10-11T17:50:00.000Z</CreationDate>
|
|
17
|
+
</Bucket>
|
|
18
|
+
<Bucket>
|
|
19
|
+
<Name>bucket-3</Name>
|
|
20
|
+
<CreationDate>2023-10-10T17:50:00.000Z</CreationDate>
|
|
21
|
+
</Bucket>
|
|
22
|
+
</Buckets>
|
|
23
|
+
</ListAllMyBucketsResult>`)));
|
|
24
|
+
export { listBucketsHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listObjectVersionsHandler: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|