@crvouga/mockingbird-service-s3 3.9.0 → 4.0.0

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.
@@ -0,0 +1,1845 @@
1
+ // src/errors.generated.ts
2
+ var MINIO_ERRORS = {
3
+ InvalidCopyDest: [
4
+ "InvalidRequest",
5
+ "This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes.",
6
+ 400
7
+ ],
8
+ InvalidCopySource: [
9
+ "InvalidArgument",
10
+ "Copy Source must mention the source bucket and key: sourcebucket/sourcekey.",
11
+ 400
12
+ ],
13
+ InvalidMetadataDirective: ["InvalidArgument", "Unknown metadata directive.", 400],
14
+ InvalidStorageClass: ["InvalidStorageClass", "Invalid storage class.", 400],
15
+ InvalidRequestBody: ["InvalidArgument", "Body shouldn't be set for this request.", 400],
16
+ InvalidMaxUploads: [
17
+ "InvalidArgument",
18
+ "Argument max-uploads must be an integer between 0 and 2147483647",
19
+ 400
20
+ ],
21
+ InvalidMaxKeys: [
22
+ "InvalidArgument",
23
+ "Argument maxKeys must be an integer between 0 and 2147483647",
24
+ 400
25
+ ],
26
+ InvalidEncodingMethod: ["InvalidArgument", "Invalid Encoding Method specified in Request", 400],
27
+ InvalidMaxParts: [
28
+ "InvalidArgument",
29
+ "Part number must be an integer between 1 and 10000, inclusive",
30
+ 400
31
+ ],
32
+ InvalidPartNumberMarker: [
33
+ "InvalidArgument",
34
+ "Argument partNumberMarker must be an integer.",
35
+ 400
36
+ ],
37
+ InvalidPartNumber: ["InvalidPartNumber", "The requested partnumber is not satisfiable", 416],
38
+ InvalidPolicyDocument: [
39
+ "InvalidPolicyDocument",
40
+ "The content of the form does not meet the conditions specified in the policy document.",
41
+ 400
42
+ ],
43
+ AccessDenied: ["AccessDenied", "Access Denied.", 403],
44
+ BadDigest: ["BadDigest", "The Content-Md5 you specified did not match what we received.", 400],
45
+ EntityTooSmall: [
46
+ "EntityTooSmall",
47
+ "Your proposed upload is smaller than the minimum allowed object size.",
48
+ 400
49
+ ],
50
+ EntityTooLarge: [
51
+ "EntityTooLarge",
52
+ "Your proposed upload exceeds the maximum allowed object size.",
53
+ 400
54
+ ],
55
+ ExcessData: ["ExcessData", "More data provided than indicated content length", 400],
56
+ PolicyInvalidName: ["PolicyInvalidName", "Policy name may not contain comma", 400],
57
+ AdminOpenIDNotEnabled: ["OpenIDNotEnabled", "No enabled OpenID Connect identity providers", 400],
58
+ PolicyTooLarge: ["PolicyTooLarge", "Policy exceeds the maximum allowed document size.", 400],
59
+ IncompleteBody: [
60
+ "IncompleteBody",
61
+ "You did not provide the number of bytes specified by the Content-Length HTTP header.",
62
+ 400
63
+ ],
64
+ InternalError: ["InternalError", "We encountered an internal error, please try again.", 500],
65
+ InvalidAccessKeyID: [
66
+ "InvalidAccessKeyId",
67
+ "The Access Key Id you provided does not exist in our records.",
68
+ 403
69
+ ],
70
+ AccessKeyDisabled: [
71
+ "InvalidAccessKeyId",
72
+ "Your account is disabled; please contact your administrator.",
73
+ 403
74
+ ],
75
+ InvalidArgument: ["InvalidArgument", "Invalid argument", 400],
76
+ InvalidBucketName: ["InvalidBucketName", "The specified bucket is not valid.", 400],
77
+ InvalidDigest: ["InvalidDigest", "The Content-Md5 you specified is not valid.", 400],
78
+ InvalidRange: ["InvalidRange", "The requested range is not satisfiable", 416],
79
+ InvalidRangePartNumber: [
80
+ "InvalidRequest",
81
+ "Cannot specify both Range header and partNumber query parameter",
82
+ 400
83
+ ],
84
+ MalformedXML: [
85
+ "MalformedXML",
86
+ "The XML you provided was not well-formed or did not validate against our published schema.",
87
+ 400
88
+ ],
89
+ MissingContentLength: [
90
+ "MissingContentLength",
91
+ "You must provide the Content-Length HTTP header.",
92
+ 411
93
+ ],
94
+ MissingContentMD5: [
95
+ "MissingContentMD5",
96
+ "Missing or invalid required header for this request: Content-Md5 or Amz-Content-Checksum",
97
+ 400
98
+ ],
99
+ MissingSecurityHeader: [
100
+ "MissingSecurityHeader",
101
+ "Your request was missing a required header",
102
+ 400
103
+ ],
104
+ MissingRequestBodyError: ["MissingRequestBodyError", "Request body is empty.", 411],
105
+ NoSuchBucket: ["NoSuchBucket", "The specified bucket does not exist", 404],
106
+ NoSuchBucketPolicy: ["NoSuchBucketPolicy", "The bucket policy does not exist", 404],
107
+ NoSuchBucketLifecycle: [
108
+ "NoSuchBucketLifecycle",
109
+ "The bucket lifecycle configuration does not exist",
110
+ 404
111
+ ],
112
+ NoSuchLifecycleConfiguration: [
113
+ "NoSuchLifecycleConfiguration",
114
+ "The lifecycle configuration does not exist",
115
+ 404
116
+ ],
117
+ InvalidLifecycleWithObjectLock: [
118
+ "InvalidLifecycleWithObjectLock",
119
+ "The lifecycle configuration containing MaxNoncurrentVersions is not supported with object locking",
120
+ 400
121
+ ],
122
+ NoSuchBucketSSEConfig: [
123
+ "ServerSideEncryptionConfigurationNotFoundError",
124
+ "The server side encryption configuration was not found",
125
+ 404
126
+ ],
127
+ NoSuchKey: ["NoSuchKey", "The specified key does not exist.", 404],
128
+ NoSuchUpload: [
129
+ "NoSuchUpload",
130
+ "The specified multipart upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed.",
131
+ 404
132
+ ],
133
+ InvalidVersionID: ["InvalidArgument", "Invalid version id specified", 400],
134
+ NoSuchVersion: ["NoSuchVersion", "The specified version does not exist.", 404],
135
+ NotImplemented: [
136
+ "NotImplemented",
137
+ "A header you provided implies functionality that is not implemented",
138
+ 501
139
+ ],
140
+ PreconditionFailed: [
141
+ "PreconditionFailed",
142
+ "At least one of the pre-conditions you specified did not hold",
143
+ 412
144
+ ],
145
+ RequestTimeTooSkewed: [
146
+ "RequestTimeTooSkewed",
147
+ "The difference between the request time and the server's time is too large.",
148
+ 403
149
+ ],
150
+ SignatureDoesNotMatch: [
151
+ "SignatureDoesNotMatch",
152
+ "The request signature we calculated does not match the signature you provided. Check your key and signing method.",
153
+ 403
154
+ ],
155
+ MethodNotAllowed: [
156
+ "MethodNotAllowed",
157
+ "The specified method is not allowed against this resource.",
158
+ 405
159
+ ],
160
+ InvalidPart: [
161
+ "InvalidPart",
162
+ "One or more of the specified parts could not be found. The part may not have been uploaded, or the specified entity tag may not match the part's entity tag.",
163
+ 400
164
+ ],
165
+ MissingPart: ["InvalidRequest", "You must specify at least one part", 400],
166
+ InvalidPartOrder: [
167
+ "InvalidPartOrder",
168
+ "The list of parts was not in ascending order. The parts list must be specified in order by part number.",
169
+ 400
170
+ ],
171
+ InvalidObjectState: [
172
+ "InvalidObjectState",
173
+ "The operation is not valid for the current state of the object.",
174
+ 403
175
+ ],
176
+ AuthorizationHeaderMalformed: [
177
+ "AuthorizationHeaderMalformed",
178
+ "The authorization header is malformed; the region is wrong; expecting 'us-east-1'.",
179
+ 400
180
+ ],
181
+ MalformedPOSTRequest: [
182
+ "MalformedPOSTRequest",
183
+ "The body of your POST request is not well-formed multipart/form-data.",
184
+ 400
185
+ ],
186
+ POSTFileRequired: ["InvalidArgument", "POST requires exactly one file upload per request.", 400],
187
+ SignatureVersionNotSupported: [
188
+ "InvalidRequest",
189
+ "The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.",
190
+ 400
191
+ ],
192
+ BucketNotEmpty: ["BucketNotEmpty", "The bucket you tried to delete is not empty", 409],
193
+ BucketAlreadyExists: [
194
+ "BucketAlreadyExists",
195
+ "The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.",
196
+ 409
197
+ ],
198
+ AllAccessDisabled: ["AllAccessDisabled", "All access to this resource has been disabled.", 403],
199
+ PolicyInvalidVersion: ["MalformedPolicy", "The policy must contain a valid version string", 400],
200
+ MissingFields: ["MissingFields", "Missing fields in request.", 400],
201
+ MissingCredTag: ["InvalidRequest", "Missing Credential field for this request.", 400],
202
+ CredMalformed: [
203
+ "AuthorizationQueryParametersError",
204
+ 'Error parsing the X-Amz-Credential parameter; the Credential is mal-formed; expecting "<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request".',
205
+ 400
206
+ ],
207
+ MalformedDate: [
208
+ "MalformedDate",
209
+ "Invalid date format header, expected to be in ISO8601, RFC1123 or RFC1123Z time format.",
210
+ 400
211
+ ],
212
+ MalformedPresignedDate: [
213
+ "AuthorizationQueryParametersError",
214
+ `X-Amz-Date must be in the ISO8601 Long Format "yyyyMMdd'T'HHmmss'Z'"`,
215
+ 400
216
+ ],
217
+ MalformedCredentialDate: [
218
+ "AuthorizationQueryParametersError",
219
+ 'Error parsing the X-Amz-Credential parameter; incorrect date format. This date in the credential must be in the format "yyyyMMdd".',
220
+ 400
221
+ ],
222
+ InvalidRegion: ["InvalidRegion", "Region does not match.", 400],
223
+ InvalidServiceS3: [
224
+ "AuthorizationParametersError",
225
+ 'Error parsing the Credential/X-Amz-Credential parameter; incorrect service. This endpoint belongs to "s3".',
226
+ 400
227
+ ],
228
+ InvalidServiceSTS: [
229
+ "AuthorizationParametersError",
230
+ 'Error parsing the Credential parameter; incorrect service. This endpoint belongs to "sts".',
231
+ 400
232
+ ],
233
+ InvalidRequestVersion: [
234
+ "AuthorizationQueryParametersError",
235
+ 'Error parsing the X-Amz-Credential parameter; incorrect terminal. This endpoint uses "aws4_request".',
236
+ 400
237
+ ],
238
+ MissingSignTag: ["AccessDenied", "Signature header missing Signature field.", 400],
239
+ MissingSignHeadersTag: ["InvalidArgument", "Signature header missing SignedHeaders field.", 400],
240
+ MalformedExpires: ["AuthorizationQueryParametersError", "X-Amz-Expires should be a number", 400],
241
+ NegativeExpires: ["AuthorizationQueryParametersError", "X-Amz-Expires must be non-negative", 400],
242
+ AuthHeaderEmpty: [
243
+ "InvalidArgument",
244
+ "Authorization header is invalid -- one and only one ' ' (space) required.",
245
+ 400
246
+ ],
247
+ MissingDateHeader: [
248
+ "AccessDenied",
249
+ "AWS authentication requires a valid Date or x-amz-date header",
250
+ 400
251
+ ],
252
+ InvalidQuerySignatureAlgo: [
253
+ "AuthorizationQueryParametersError",
254
+ 'X-Amz-Algorithm only supports "AWS4-HMAC-SHA256".',
255
+ 400
256
+ ],
257
+ ExpiredPresignRequest: ["AccessDenied", "Request has expired", 403],
258
+ RequestNotReadyYet: ["AccessDenied", "Request is not valid yet", 403],
259
+ SlowDownRead: [
260
+ "SlowDownRead",
261
+ "Resource requested is unreadable, please reduce your request rate",
262
+ 503
263
+ ],
264
+ SlowDownWrite: [
265
+ "SlowDownWrite",
266
+ "Resource requested is unwritable, please reduce your request rate",
267
+ 503
268
+ ],
269
+ MaxVersionsExceeded: [
270
+ "MaxVersionsExceeded",
271
+ "You've exceeded the limit on the number of versions you can create on this object",
272
+ 400
273
+ ],
274
+ InvalidPrefixMarker: ["InvalidPrefixMarker", "Invalid marker prefix combination", 400],
275
+ BadRequest: ["BadRequest", "400 BadRequest", 400],
276
+ KeyTooLongError: ["KeyTooLongError", "Your key is too long", 400],
277
+ UnsignedHeaders: [
278
+ "AccessDenied",
279
+ "There were headers present in the request which were not signed",
280
+ 400
281
+ ],
282
+ InvalidQueryParams: [
283
+ "AuthorizationQueryParametersError",
284
+ "Query-string authentication version 4 requires the X-Amz-Algorithm, X-Amz-Credential, X-Amz-Signature, X-Amz-Date, X-Amz-SignedHeaders, and X-Amz-Expires parameters.",
285
+ 400
286
+ ],
287
+ BucketAlreadyOwnedByYou: [
288
+ "BucketAlreadyOwnedByYou",
289
+ "Your previous request to create the named bucket succeeded and you already own it.",
290
+ 409
291
+ ],
292
+ InvalidDuration: ["InvalidDuration", "Duration provided in the request is invalid.", 400],
293
+ InvalidBucketObjectLockConfiguration: [
294
+ "InvalidRequest",
295
+ "Bucket is missing ObjectLockConfiguration",
296
+ 400
297
+ ],
298
+ BucketTaggingNotFound: ["NoSuchTagSet", "The TagSet does not exist", 404],
299
+ ObjectLockConfigurationNotFound: [
300
+ "ObjectLockConfigurationNotFoundError",
301
+ "Object Lock configuration does not exist for this bucket",
302
+ 404
303
+ ],
304
+ ObjectLockConfigurationNotAllowed: [
305
+ "InvalidBucketState",
306
+ "Object Lock configuration cannot be enabled on existing buckets",
307
+ 409
308
+ ],
309
+ NoSuchCORSConfiguration: [
310
+ "NoSuchCORSConfiguration",
311
+ "The CORS configuration does not exist",
312
+ 404
313
+ ],
314
+ NoSuchWebsiteConfiguration: [
315
+ "NoSuchWebsiteConfiguration",
316
+ "The specified bucket does not have a website configuration",
317
+ 404
318
+ ],
319
+ ReplicationConfigurationNotFoundError: [
320
+ "ReplicationConfigurationNotFoundError",
321
+ "The replication configuration was not found",
322
+ 404
323
+ ],
324
+ RemoteDestinationNotFoundError: [
325
+ "RemoteDestinationNotFoundError",
326
+ "The remote destination bucket does not exist",
327
+ 404
328
+ ],
329
+ ReplicationDestinationMissingLock: [
330
+ "ReplicationDestinationMissingLockError",
331
+ "The replication destination bucket does not have object locking enabled",
332
+ 400
333
+ ],
334
+ RemoteTargetNotFoundError: [
335
+ "XMinioAdminRemoteTargetNotFoundError",
336
+ "The remote target does not exist",
337
+ 404
338
+ ],
339
+ ReplicationRemoteConnectionError: [
340
+ "XMinioAdminReplicationRemoteConnectionError",
341
+ "Remote service connection error",
342
+ 503
343
+ ],
344
+ ReplicationBandwidthLimitError: [
345
+ "XMinioAdminReplicationBandwidthLimitError",
346
+ "Bandwidth limit for remote target must be at least 100MBps",
347
+ 400
348
+ ],
349
+ ReplicationNoExistingObjects: [
350
+ "XMinioReplicationNoExistingObjects",
351
+ "No matching ExistingObjects rule enabled",
352
+ 400
353
+ ],
354
+ RemoteTargetDenyAddError: [
355
+ "XMinioAdminRemoteTargetDenyAdd",
356
+ "Cannot add remote target endpoint since this server is in a cluster replication setup",
357
+ 400
358
+ ],
359
+ ReplicationDenyEditError: [
360
+ "XMinioReplicationDenyEdit",
361
+ "Cannot alter local replication config since this server is in a cluster replication setup",
362
+ 400
363
+ ],
364
+ BucketRemoteIdenticalToSource: [
365
+ "XMinioAdminRemoteIdenticalToSource",
366
+ "The remote target cannot be identical to source",
367
+ 400
368
+ ],
369
+ BucketRemoteAlreadyExists: [
370
+ "XMinioAdminBucketRemoteAlreadyExists",
371
+ "The remote target already exists",
372
+ 400
373
+ ],
374
+ BucketRemoteLabelInUse: [
375
+ "XMinioAdminBucketRemoteLabelInUse",
376
+ "The remote target with this label already exists",
377
+ 400
378
+ ],
379
+ BucketRemoteRemoveDisallowed: [
380
+ "XMinioAdminRemoteRemoveDisallowed",
381
+ "This ARN is in use by an existing configuration",
382
+ 400
383
+ ],
384
+ BucketRemoteArnTypeInvalid: [
385
+ "XMinioAdminRemoteARNTypeInvalid",
386
+ "The bucket remote ARN type is not valid",
387
+ 400
388
+ ],
389
+ BucketRemoteArnInvalid: [
390
+ "XMinioAdminRemoteArnInvalid",
391
+ "The bucket remote ARN does not have correct format",
392
+ 400
393
+ ],
394
+ RemoteTargetNotVersionedError: [
395
+ "RemoteTargetNotVersionedError",
396
+ "The remote target does not have versioning enabled",
397
+ 400
398
+ ],
399
+ ReplicationSourceNotVersionedError: [
400
+ "ReplicationSourceNotVersionedError",
401
+ "The replication source does not have versioning enabled",
402
+ 400
403
+ ],
404
+ ReplicationNeedsVersioningError: [
405
+ "InvalidRequest",
406
+ "Versioning must be 'Enabled' on the bucket to apply a replication configuration",
407
+ 400
408
+ ],
409
+ ReplicationBucketNeedsVersioningError: [
410
+ "InvalidRequest",
411
+ "Versioning must be 'Enabled' on the bucket to add a replication target",
412
+ 400
413
+ ],
414
+ ReplicationValidationError: ["InvalidRequest", "Replication validation failed on target", 400],
415
+ ReplicationPermissionCheckError: [
416
+ "ReplicationPermissionCheck",
417
+ "X-Minio-Source-Replication-Check cannot be specified in request. Request cannot be completed",
418
+ 400
419
+ ],
420
+ NoSuchObjectLockConfiguration: [
421
+ "NoSuchObjectLockConfiguration",
422
+ "The specified object does not have a ObjectLock configuration",
423
+ 400
424
+ ],
425
+ ObjectLocked: ["InvalidRequest", "Object is WORM protected and cannot be overwritten", 400],
426
+ InvalidRetentionDate: ["InvalidRequest", "Date must be provided in ISO 8601 format", 400],
427
+ PastObjectLockRetainDate: ["InvalidRequest", "the retain until date must be in the future", 400],
428
+ UnknownWORMModeDirective: ["InvalidRequest", "unknown wormMode directive", 400],
429
+ ObjectLockInvalidHeaders: [
430
+ "InvalidRequest",
431
+ "x-amz-object-lock-retain-until-date and x-amz-object-lock-mode must both be supplied",
432
+ 400
433
+ ],
434
+ ObjectRestoreAlreadyInProgress: [
435
+ "RestoreAlreadyInProgress",
436
+ "Object restore is already in progress",
437
+ 409
438
+ ],
439
+ TransitionStorageClassNotFoundError: [
440
+ "TransitionStorageClassNotFoundError",
441
+ "The transition storage class was not found",
442
+ 404
443
+ ],
444
+ EventNotification: [
445
+ "InvalidArgument",
446
+ "A specified event is not supported for notifications.",
447
+ 400
448
+ ],
449
+ ARNNotification: [
450
+ "InvalidArgument",
451
+ "A specified destination ARN does not exist or is not well-formed. Verify the destination ARN.",
452
+ 400
453
+ ],
454
+ RegionNotification: [
455
+ "InvalidArgument",
456
+ "A specified destination is in a different region than the bucket. You must use a destination that resides in the same region as the bucket.",
457
+ 400
458
+ ],
459
+ OverlappingFilterNotification: [
460
+ "InvalidArgument",
461
+ "An object key name filtering rule defined with overlapping prefixes, overlapping suffixes, or overlapping combinations of prefixes and suffixes for the same event types.",
462
+ 400
463
+ ],
464
+ FilterNameInvalid: ["InvalidArgument", "filter rule name must be either prefix or suffix", 400],
465
+ FilterNamePrefix: [
466
+ "InvalidArgument",
467
+ "Cannot specify more than one prefix rule in a filter.",
468
+ 400
469
+ ],
470
+ FilterNameSuffix: [
471
+ "InvalidArgument",
472
+ "Cannot specify more than one suffix rule in a filter.",
473
+ 400
474
+ ],
475
+ FilterValueInvalid: [
476
+ "InvalidArgument",
477
+ "Size of filter rule value cannot exceed 1024 bytes in UTF-8 representation",
478
+ 400
479
+ ],
480
+ OverlappingConfigs: [
481
+ "InvalidArgument",
482
+ "Configurations overlap. Configurations on the same bucket cannot share a common event type.",
483
+ 400
484
+ ],
485
+ UnsupportedNotification: [
486
+ "UnsupportedNotification",
487
+ "MinIO server does not support Topic or Cloud Function based notifications.",
488
+ 400
489
+ ],
490
+ InvalidCopyPartRange: [
491
+ "InvalidArgument",
492
+ "The x-amz-copy-source-range value must be of the form bytes=first-last where first and last are the zero-based offsets of the first and last bytes to copy",
493
+ 400
494
+ ],
495
+ InvalidCopyPartRangeSource: [
496
+ "InvalidArgument",
497
+ "Range specified is not valid for source object",
498
+ 400
499
+ ],
500
+ MetadataTooLarge: [
501
+ "MetadataTooLarge",
502
+ "Your metadata headers exceed the maximum allowed metadata size.",
503
+ 400
504
+ ],
505
+ InvalidTagDirective: ["InvalidArgument", "Unknown tag directive.", 400],
506
+ InvalidEncryptionMethod: [
507
+ "InvalidArgument",
508
+ "Server Side Encryption with AWS KMS managed key requires HTTP header x-amz-server-side-encryption : aws:kms",
509
+ 400
510
+ ],
511
+ IncompatibleEncryptionMethod: [
512
+ "InvalidArgument",
513
+ "Server Side Encryption with Customer provided key is incompatible with the encryption method specified",
514
+ 400
515
+ ],
516
+ InvalidEncryptionKeyID: [
517
+ "InvalidRequest",
518
+ "The specified KMS KeyID contains unsupported characters",
519
+ 400
520
+ ],
521
+ InsecureSSECustomerRequest: [
522
+ "InvalidRequest",
523
+ "Requests specifying Server Side Encryption with Customer provided keys must be made over a secure connection.",
524
+ 400
525
+ ],
526
+ SSEMultipartEncrypted: [
527
+ "InvalidRequest",
528
+ "The multipart upload initiate requested encryption. Subsequent part requests must include the appropriate encryption parameters.",
529
+ 400
530
+ ],
531
+ SSEEncryptedObject: [
532
+ "InvalidRequest",
533
+ "The object was stored using a form of Server Side Encryption. The correct parameters must be provided to retrieve the object.",
534
+ 400
535
+ ],
536
+ InvalidEncryptionParameters: [
537
+ "InvalidRequest",
538
+ "The encryption parameters are not applicable to this object.",
539
+ 400
540
+ ],
541
+ InvalidEncryptionParametersSSEC: [
542
+ "InvalidRequest",
543
+ "SSE-C encryption parameters are not supported on replicated bucket.",
544
+ 400
545
+ ],
546
+ InvalidSSECustomerAlgorithm: [
547
+ "InvalidArgument",
548
+ "Requests specifying Server Side Encryption with Customer provided keys must provide a valid encryption algorithm.",
549
+ 400
550
+ ],
551
+ InvalidSSECustomerKey: [
552
+ "InvalidArgument",
553
+ "The secret key was invalid for the specified algorithm.",
554
+ 400
555
+ ],
556
+ MissingSSECustomerKey: [
557
+ "InvalidArgument",
558
+ "Requests specifying Server Side Encryption with Customer provided keys must provide an appropriate secret key.",
559
+ 400
560
+ ],
561
+ MissingSSECustomerKeyMD5: [
562
+ "InvalidArgument",
563
+ "Requests specifying Server Side Encryption with Customer provided keys must provide the client calculated MD5 of the secret key.",
564
+ 400
565
+ ],
566
+ SSECustomerKeyMD5Mismatch: [
567
+ "InvalidArgument",
568
+ "The calculated MD5 hash of the key did not match the hash that was provided.",
569
+ 400
570
+ ],
571
+ InvalidSSECustomerParameters: [
572
+ "InvalidArgument",
573
+ "The provided encryption parameters did not match the ones used originally.",
574
+ 400
575
+ ],
576
+ KMSNotConfigured: [
577
+ "NotImplemented",
578
+ "Server side encryption specified but KMS is not configured",
579
+ 501
580
+ ],
581
+ KMSKeyNotFoundException: ["KMS.NotFoundException", "Invalid keyId", 400],
582
+ KMSDefaultKeyAlreadyConfigured: [
583
+ "KMS.DefaultKeyAlreadyConfiguredException",
584
+ "A default encryption already exists and cannot be changed on KMS",
585
+ 409
586
+ ],
587
+ NoAccessKey: ["AccessDenied", "No AWSAccessKey was presented", 403],
588
+ InvalidToken: ["InvalidTokenId", "The security token included in the request is invalid", 403],
589
+ NoTokenRevokeType: [
590
+ "InvalidArgument",
591
+ "No token revoke type specified and one could not be inferred from the request",
592
+ 400
593
+ ],
594
+ AdminNoSuchAccessKey: [
595
+ "XMinioAdminNoSuchAccessKey",
596
+ "The specified access key does not exist.",
597
+ 404
598
+ ],
599
+ ContentSHA256Mismatch: [
600
+ "XAmzContentSHA256Mismatch",
601
+ "The provided 'x-amz-content-sha256' header does not match what was computed.",
602
+ 400
603
+ ],
604
+ ContentChecksumMismatch: [
605
+ "XAmzContentChecksumMismatch",
606
+ "The provided 'x-amz-checksum' header does not match what was computed.",
607
+ 400
608
+ ],
609
+ StorageFull: [
610
+ "XMinioStorageFull",
611
+ "Storage backend has reached its minimum free drive threshold. Please delete a few objects to proceed.",
612
+ 507
613
+ ],
614
+ RequestBodyParse: ["XMinioRequestBodyParse", "The request body failed to parse.", 400],
615
+ ObjectExistsAsDirectory: [
616
+ "XMinioObjectExistsAsDirectory",
617
+ "Object name already exists as a directory.",
618
+ 400
619
+ ],
620
+ InvalidObjectName: [
621
+ "XMinioInvalidObjectName",
622
+ "Object name contains unsupported characters.",
623
+ 400
624
+ ],
625
+ InvalidObjectNamePrefixSlash: [
626
+ "XMinioInvalidObjectName",
627
+ "Object name contains a leading slash.",
628
+ 400
629
+ ],
630
+ InvalidResourceName: [
631
+ "XMinioInvalidResourceName",
632
+ 'Resource name contains bad components such as ".." or ".".',
633
+ 400
634
+ ],
635
+ ServerNotInitialized: [
636
+ "XMinioServerNotInitialized",
637
+ "Server not initialized yet, please try again.",
638
+ 503
639
+ ],
640
+ IAMNotInitialized: [
641
+ "XMinioIAMNotInitialized",
642
+ "IAM sub-system not initialized yet, please try again.",
643
+ 503
644
+ ],
645
+ BucketMetadataNotInitialized: [
646
+ "XMinioBucketMetadataNotInitialized",
647
+ "Bucket metadata not initialized yet, please try again.",
648
+ 503
649
+ ],
650
+ MalformedJSON: [
651
+ "XMinioMalformedJSON",
652
+ "The JSON you provided was not well-formed or did not validate against our published format.",
653
+ 400
654
+ ],
655
+ InvalidLifecycleQueryParameter: [
656
+ "XMinioInvalidLifecycleParameter",
657
+ "The boolean value provided for withUpdatedAt query parameter was invalid.",
658
+ 400
659
+ ],
660
+ AdminNoSuchUser: ["XMinioAdminNoSuchUser", "The specified user does not exist.", 404],
661
+ AdminNoSuchUserLDAPWarn: [
662
+ "XMinioAdminNoSuchUser",
663
+ "The specified user does not exist. If you meant a user in LDAP, use `mc idp ldap`",
664
+ 404
665
+ ],
666
+ AdminNoSuchGroup: ["XMinioAdminNoSuchGroup", "The specified group does not exist.", 404],
667
+ AdminNoSuchJob: ["XMinioAdminNoSuchJob", "The specified job does not exist.", 404],
668
+ AdminGroupNotEmpty: [
669
+ "XMinioAdminGroupNotEmpty",
670
+ "The specified group is not empty - cannot remove it.",
671
+ 400
672
+ ],
673
+ AdminGroupDisabled: ["XMinioAdminGroupDisabled", "The specified group is disabled.", 400],
674
+ AdminNoSuchPolicy: ["XMinioAdminNoSuchPolicy", "The canned policy does not exist.", 404],
675
+ AdminPolicyChangeAlreadyApplied: [
676
+ "XMinioAdminPolicyChangeAlreadyApplied",
677
+ "The specified policy change is already in effect.",
678
+ 400
679
+ ],
680
+ AdminInvalidArgument: ["XMinioAdminInvalidArgument", "Invalid arguments specified.", 400],
681
+ AdminInvalidAccessKey: ["XMinioAdminInvalidAccessKey", "The access key is invalid.", 400],
682
+ AdminInvalidSecretKey: ["XMinioAdminInvalidSecretKey", "The secret key is invalid.", 400],
683
+ AdminNoAccessKey: ["XMinioAdminNoAccessKey", "No access key was provided.", 400],
684
+ AdminNoSecretKey: ["XMinioAdminNoSecretKey", "No secret key was provided.", 400],
685
+ AdminConfigNoQuorum: [
686
+ "XMinioAdminConfigNoQuorum",
687
+ "Configuration update failed because server quorum was not met",
688
+ 503
689
+ ],
690
+ AdminConfigTooLarge: [
691
+ "XMinioAdminConfigTooLarge",
692
+ "Configuration data provided exceeds the allowed maximum of %d bytes",
693
+ 400
694
+ ],
695
+ AdminNoSuchConfigTarget: [
696
+ "XMinioAdminNoSuchConfigTarget",
697
+ "No such named configuration target exists",
698
+ 400
699
+ ],
700
+ AdminConfigBadJSON: [
701
+ "XMinioAdminConfigBadJSON",
702
+ "JSON configuration provided is of incorrect format",
703
+ 400
704
+ ],
705
+ AdminConfigEnvOverridden: [
706
+ "XMinioAdminConfigEnvOverridden",
707
+ "Unable to update config via Admin API due to environment variable override",
708
+ 400
709
+ ],
710
+ AdminConfigDuplicateKeys: [
711
+ "XMinioAdminConfigDuplicateKeys",
712
+ "JSON configuration provided has objects with duplicate keys",
713
+ 400
714
+ ],
715
+ AdminConfigInvalidIDPType: [
716
+ "XMinioAdminConfigInvalidIDPType",
717
+ "Invalid IDP configuration type - must be one of %v",
718
+ 400
719
+ ],
720
+ AdminConfigLDAPNonDefaultConfigName: [
721
+ "XMinioAdminConfigLDAPNonDefaultConfigName",
722
+ "Only a single LDAP configuration is supported - config name must be empty or `_`",
723
+ 400
724
+ ],
725
+ AdminConfigLDAPValidation: [
726
+ "XMinioAdminConfigLDAPValidation",
727
+ "LDAP Configuration validation failed",
728
+ 400
729
+ ],
730
+ AdminConfigIDPCfgNameAlreadyExists: [
731
+ "XMinioAdminConfigIDPCfgNameAlreadyExists",
732
+ "An IDP configuration with the given name already exists",
733
+ 400
734
+ ],
735
+ AdminConfigIDPCfgNameDoesNotExist: [
736
+ "XMinioAdminConfigIDPCfgNameDoesNotExist",
737
+ "No such IDP configuration exists",
738
+ 400
739
+ ],
740
+ AdminConfigNotificationTargetsFailed: [
741
+ "XMinioAdminNotificationTargetsTestFailed",
742
+ "Configuration update failed due an unsuccessful attempt to connect to one or more notification servers",
743
+ 400
744
+ ],
745
+ AdminProfilerNotEnabled: [
746
+ "XMinioAdminProfilerNotEnabled",
747
+ "Unable to perform the requested operation because profiling is not enabled",
748
+ 400
749
+ ],
750
+ AdminBucketQuotaExceeded: ["XMinioAdminBucketQuotaExceeded", "Bucket quota exceeded", 400],
751
+ AdminNoSuchQuotaConfiguration: [
752
+ "XMinioAdminNoSuchQuotaConfiguration",
753
+ "The quota configuration does not exist",
754
+ 404
755
+ ],
756
+ InsecureClientRequest: [
757
+ "XMinioInsecureClientRequest",
758
+ "Cannot respond to plain-text request from TLS-encrypted server",
759
+ 400
760
+ ],
761
+ RequestTimedout: [
762
+ "RequestTimeout",
763
+ "A timeout occurred while trying to lock a resource, please reduce your request rate",
764
+ 503
765
+ ],
766
+ TooManyRequests: ["TooManyRequests", "Please reduce your request rate", 429],
767
+ UnsupportedMetadata: ["InvalidArgument", "Your metadata headers are not supported.", 400],
768
+ UnsupportedHostHeader: ["InvalidArgument", "Your Host header is malformed.", 400],
769
+ SiteReplicationInvalidRequest: [
770
+ "XMinioSiteReplicationInvalidRequest",
771
+ "Invalid site-replication request",
772
+ 400
773
+ ],
774
+ SiteReplicationPeerResp: [
775
+ "XMinioSiteReplicationPeerResp",
776
+ "Error received when contacting a peer site",
777
+ 400
778
+ ],
779
+ SiteReplicationBackendIssue: [
780
+ "XMinioSiteReplicationBackendIssue",
781
+ "Error when requesting object layer backend",
782
+ 503
783
+ ],
784
+ SiteReplicationServiceAccountError: [
785
+ "XMinioSiteReplicationServiceAccountError",
786
+ "Site replication related service account error",
787
+ 503
788
+ ],
789
+ SiteReplicationBucketConfigError: [
790
+ "XMinioSiteReplicationBucketConfigError",
791
+ "Error while configuring replication on a bucket",
792
+ 503
793
+ ],
794
+ SiteReplicationBucketMetaError: [
795
+ "XMinioSiteReplicationBucketMetaError",
796
+ "Error while replicating bucket metadata",
797
+ 503
798
+ ],
799
+ SiteReplicationIAMError: [
800
+ "XMinioSiteReplicationIAMError",
801
+ "Error while replicating an IAM item",
802
+ 503
803
+ ],
804
+ SiteReplicationConfigMissing: [
805
+ "XMinioSiteReplicationConfigMissingError",
806
+ "Site not found in site replication configuration",
807
+ 400
808
+ ],
809
+ SiteReplicationIAMConfigMismatch: [
810
+ "XMinioSiteReplicationIAMConfigMismatch",
811
+ "IAM configuration mismatch between sites",
812
+ 400
813
+ ],
814
+ AdminRebalanceAlreadyStarted: [
815
+ "XMinioAdminRebalanceAlreadyStarted",
816
+ "Pool rebalance is already started",
817
+ 409
818
+ ],
819
+ AdminRebalanceNotStarted: [
820
+ "XMinioAdminRebalanceNotStarted",
821
+ "Pool rebalance is not started",
822
+ 404
823
+ ],
824
+ MaximumExpires: [
825
+ "AuthorizationQueryParametersError",
826
+ "X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 seconds",
827
+ 400
828
+ ],
829
+ InvalidRequest: ["InvalidRequest", "Invalid Request", 400],
830
+ HealNotImplemented: [
831
+ "XMinioHealNotImplemented",
832
+ "This server does not implement heal functionality.",
833
+ 400
834
+ ],
835
+ HealNoSuchProcess: [
836
+ "XMinioHealNoSuchProcess",
837
+ "No such heal process is running on the server",
838
+ 400
839
+ ],
840
+ HealInvalidClientToken: ["XMinioHealInvalidClientToken", "Client token mismatch", 400],
841
+ HealMissingBucket: [
842
+ "XMinioHealMissingBucket",
843
+ "A heal start request with a non-empty object-prefix parameter requires a bucket to be specified.",
844
+ 400
845
+ ],
846
+ HealAlreadyRunning: ["XMinioHealAlreadyRunning", "", 400],
847
+ HealOverlappingPaths: ["XMinioHealOverlappingPaths", "", 400],
848
+ BackendDown: ["XMinioBackendDown", "Remote backend is unreachable", 400],
849
+ IncorrectContinuationToken: [
850
+ "InvalidArgument",
851
+ "The continuation token provided is incorrect",
852
+ 400
853
+ ],
854
+ EmptyRequestBody: ["EmptyRequestBody", "Request body cannot be empty.", 400],
855
+ UnsupportedFunction: ["UnsupportedFunction", "Encountered an unsupported SQL function.", 400],
856
+ InvalidDataSource: [
857
+ "InvalidDataSource",
858
+ "Invalid data source type. Only CSV and JSON are supported at this time.",
859
+ 400
860
+ ],
861
+ InvalidExpressionType: [
862
+ "InvalidExpressionType",
863
+ "The ExpressionType is invalid. Only SQL expressions are supported at this time.",
864
+ 400
865
+ ],
866
+ Busy: ["ServerBusy", "The service is unavailable. Please retry.", 503],
867
+ UnauthorizedAccess: [
868
+ "UnauthorizedAccess",
869
+ "You are not authorized to perform this operation",
870
+ 401
871
+ ],
872
+ ExpressionTooLong: [
873
+ "ExpressionTooLong",
874
+ "The SQL expression is too long: The maximum byte-length for the SQL expression is 256 KB.",
875
+ 400
876
+ ],
877
+ IllegalSQLFunctionArgument: [
878
+ "IllegalSqlFunctionArgument",
879
+ "Illegal argument was used in the SQL function.",
880
+ 400
881
+ ],
882
+ InvalidKeyPath: ["InvalidKeyPath", "Key path in the SQL expression is invalid.", 400],
883
+ InvalidCompressionFormat: [
884
+ "InvalidCompressionFormat",
885
+ "The file is not in a supported compression format. Only GZIP is supported at this time.",
886
+ 400
887
+ ],
888
+ InvalidFileHeaderInfo: [
889
+ "InvalidFileHeaderInfo",
890
+ "The FileHeaderInfo is invalid. Only NONE, USE, and IGNORE are supported.",
891
+ 400
892
+ ],
893
+ InvalidJSONType: [
894
+ "InvalidJsonType",
895
+ "The JsonType is invalid. Only DOCUMENT and LINES are supported at this time.",
896
+ 400
897
+ ],
898
+ InvalidQuoteFields: [
899
+ "InvalidQuoteFields",
900
+ "The QuoteFields is invalid. Only ALWAYS and ASNEEDED are supported.",
901
+ 400
902
+ ],
903
+ InvalidRequestParameter: [
904
+ "InvalidRequestParameter",
905
+ "The value of a parameter in SelectRequest element is invalid. Check the service API documentation and try again.",
906
+ 400
907
+ ],
908
+ InvalidDataType: ["InvalidDataType", "The SQL expression contains an invalid data type.", 400],
909
+ InvalidTextEncoding: [
910
+ "InvalidTextEncoding",
911
+ "Invalid encoding type. Only UTF-8 encoding is supported at this time.",
912
+ 400
913
+ ],
914
+ InvalidTableAlias: [
915
+ "InvalidTableAlias",
916
+ "The SQL expression contains an invalid table alias.",
917
+ 400
918
+ ],
919
+ MissingRequiredParameter: [
920
+ "MissingRequiredParameter",
921
+ "The SelectRequest entity is missing a required parameter. Check the service documentation and try again.",
922
+ 400
923
+ ],
924
+ ObjectSerializationConflict: [
925
+ "ObjectSerializationConflict",
926
+ "The SelectRequest entity can only contain one of CSV or JSON. Check the service documentation and try again.",
927
+ 400
928
+ ],
929
+ UnsupportedSQLOperation: [
930
+ "UnsupportedSqlOperation",
931
+ "Encountered an unsupported SQL operation.",
932
+ 400
933
+ ],
934
+ UnsupportedSQLStructure: [
935
+ "UnsupportedSqlStructure",
936
+ "Encountered an unsupported SQL structure. Check the SQL Reference.",
937
+ 400
938
+ ],
939
+ UnsupportedSyntax: ["UnsupportedSyntax", "Encountered invalid syntax.", 400],
940
+ UnsupportedRangeHeader: [
941
+ "UnsupportedRangeHeader",
942
+ "Range header is not supported for this operation.",
943
+ 400
944
+ ],
945
+ LexerInvalidChar: ["LexerInvalidChar", "The SQL expression contains an invalid character.", 400],
946
+ LexerInvalidOperator: [
947
+ "LexerInvalidOperator",
948
+ "The SQL expression contains an invalid literal.",
949
+ 400
950
+ ],
951
+ LexerInvalidLiteral: [
952
+ "LexerInvalidLiteral",
953
+ "The SQL expression contains an invalid operator.",
954
+ 400
955
+ ],
956
+ LexerInvalidIONLiteral: [
957
+ "LexerInvalidIONLiteral",
958
+ "The SQL expression contains an invalid operator.",
959
+ 400
960
+ ],
961
+ ParseExpectedDatePart: [
962
+ "ParseExpectedDatePart",
963
+ "Did not find the expected date part in the SQL expression.",
964
+ 400
965
+ ],
966
+ ParseExpectedKeyword: [
967
+ "ParseExpectedKeyword",
968
+ "Did not find the expected keyword in the SQL expression.",
969
+ 400
970
+ ],
971
+ ParseExpectedTokenType: [
972
+ "ParseExpectedTokenType",
973
+ "Did not find the expected token in the SQL expression.",
974
+ 400
975
+ ],
976
+ ParseExpected2TokenTypes: [
977
+ "ParseExpected2TokenTypes",
978
+ "Did not find the expected token in the SQL expression.",
979
+ 400
980
+ ],
981
+ ParseExpectedNumber: [
982
+ "ParseExpectedNumber",
983
+ "Did not find the expected number in the SQL expression.",
984
+ 400
985
+ ],
986
+ ParseExpectedRightParenBuiltinFunctionCall: [
987
+ "ParseExpectedRightParenBuiltinFunctionCall",
988
+ "Did not find the expected right parenthesis character in the SQL expression.",
989
+ 400
990
+ ],
991
+ ParseExpectedTypeName: [
992
+ "ParseExpectedTypeName",
993
+ "Did not find the expected type name in the SQL expression.",
994
+ 400
995
+ ],
996
+ ParseExpectedWhenClause: [
997
+ "ParseExpectedWhenClause",
998
+ "Did not find the expected WHEN clause in the SQL expression. CASE is not supported.",
999
+ 400
1000
+ ],
1001
+ ParseUnsupportedToken: [
1002
+ "ParseUnsupportedToken",
1003
+ "The SQL expression contains an unsupported token.",
1004
+ 400
1005
+ ],
1006
+ ParseUnsupportedLiteralsGroupBy: [
1007
+ "ParseUnsupportedLiteralsGroupBy",
1008
+ "The SQL expression contains an unsupported use of GROUP BY.",
1009
+ 400
1010
+ ],
1011
+ ParseExpectedMember: [
1012
+ "ParseExpectedMember",
1013
+ "The SQL expression contains an unsupported use of MEMBER.",
1014
+ 400
1015
+ ],
1016
+ ParseUnsupportedSelect: [
1017
+ "ParseUnsupportedSelect",
1018
+ "The SQL expression contains an unsupported use of SELECT.",
1019
+ 400
1020
+ ],
1021
+ ParseUnsupportedCase: [
1022
+ "ParseUnsupportedCase",
1023
+ "The SQL expression contains an unsupported use of CASE.",
1024
+ 400
1025
+ ],
1026
+ ParseUnsupportedCaseClause: [
1027
+ "ParseUnsupportedCaseClause",
1028
+ "The SQL expression contains an unsupported use of CASE.",
1029
+ 400
1030
+ ],
1031
+ ParseUnsupportedAlias: [
1032
+ "ParseUnsupportedAlias",
1033
+ "The SQL expression contains an unsupported use of ALIAS.",
1034
+ 400
1035
+ ],
1036
+ ParseUnsupportedSyntax: [
1037
+ "ParseUnsupportedSyntax",
1038
+ "The SQL expression contains unsupported syntax.",
1039
+ 400
1040
+ ],
1041
+ ParseUnknownOperator: [
1042
+ "ParseUnknownOperator",
1043
+ "The SQL expression contains an invalid operator.",
1044
+ 400
1045
+ ],
1046
+ ParseMissingIdentAfterAt: [
1047
+ "ParseMissingIdentAfterAt",
1048
+ "Did not find the expected identifier after the @ symbol in the SQL expression.",
1049
+ 400
1050
+ ],
1051
+ ParseUnexpectedOperator: [
1052
+ "ParseUnexpectedOperator",
1053
+ "The SQL expression contains an unexpected operator.",
1054
+ 400
1055
+ ],
1056
+ ParseUnexpectedTerm: [
1057
+ "ParseUnexpectedTerm",
1058
+ "The SQL expression contains an unexpected term.",
1059
+ 400
1060
+ ],
1061
+ ParseUnexpectedToken: [
1062
+ "ParseUnexpectedToken",
1063
+ "The SQL expression contains an unexpected token.",
1064
+ 400
1065
+ ],
1066
+ ParseUnexpectedKeyword: [
1067
+ "ParseUnexpectedKeyword",
1068
+ "The SQL expression contains an unexpected keyword.",
1069
+ 400
1070
+ ],
1071
+ ParseExpectedExpression: [
1072
+ "ParseExpectedExpression",
1073
+ "Did not find the expected SQL expression.",
1074
+ 400
1075
+ ],
1076
+ ParseExpectedLeftParenAfterCast: [
1077
+ "ParseExpectedLeftParenAfterCast",
1078
+ "Did not find expected the left parenthesis in the SQL expression.",
1079
+ 400
1080
+ ],
1081
+ ParseExpectedLeftParenValueConstructor: [
1082
+ "ParseExpectedLeftParenValueConstructor",
1083
+ "Did not find expected the left parenthesis in the SQL expression.",
1084
+ 400
1085
+ ],
1086
+ ParseExpectedLeftParenBuiltinFunctionCall: [
1087
+ "ParseExpectedLeftParenBuiltinFunctionCall",
1088
+ "Did not find the expected left parenthesis in the SQL expression.",
1089
+ 400
1090
+ ],
1091
+ ParseExpectedArgumentDelimiter: [
1092
+ "ParseExpectedArgumentDelimiter",
1093
+ "Did not find the expected argument delimiter in the SQL expression.",
1094
+ 400
1095
+ ],
1096
+ ParseCastArity: ["ParseCastArity", "The SQL expression CAST has incorrect arity.", 400],
1097
+ ParseInvalidTypeParam: [
1098
+ "ParseInvalidTypeParam",
1099
+ "The SQL expression contains an invalid parameter value.",
1100
+ 400
1101
+ ],
1102
+ ParseEmptySelect: ["ParseEmptySelect", "The SQL expression contains an empty SELECT.", 400],
1103
+ ParseSelectMissingFrom: [
1104
+ "ParseSelectMissingFrom",
1105
+ "GROUP is not supported in the SQL expression.",
1106
+ 400
1107
+ ],
1108
+ ParseExpectedIdentForGroupName: [
1109
+ "ParseExpectedIdentForGroupName",
1110
+ "GROUP is not supported in the SQL expression.",
1111
+ 400
1112
+ ],
1113
+ ParseExpectedIdentForAlias: [
1114
+ "ParseExpectedIdentForAlias",
1115
+ "Did not find the expected identifier for the alias in the SQL expression.",
1116
+ 400
1117
+ ],
1118
+ ParseUnsupportedCallWithStar: [
1119
+ "ParseUnsupportedCallWithStar",
1120
+ "Only COUNT with (*) as a parameter is supported in the SQL expression.",
1121
+ 400
1122
+ ],
1123
+ ParseNonUnaryAggregateFunctionCall: [
1124
+ "ParseNonUnaryAggregateFunctionCall",
1125
+ "Only one argument is supported for aggregate functions in the SQL expression.",
1126
+ 400
1127
+ ],
1128
+ ParseMalformedJoin: ["ParseMalformedJoin", "JOIN is not supported in the SQL expression.", 400],
1129
+ ParseExpectedIdentForAt: [
1130
+ "ParseExpectedIdentForAt",
1131
+ "Did not find the expected identifier for AT name in the SQL expression.",
1132
+ 400
1133
+ ],
1134
+ ParseAsteriskIsNotAloneInSelectList: [
1135
+ "ParseAsteriskIsNotAloneInSelectList",
1136
+ "Other expressions are not allowed in the SELECT list when '*' is used without dot notation in the SQL expression.",
1137
+ 400
1138
+ ],
1139
+ ParseCannotMixSqbAndWildcardInSelectList: [
1140
+ "ParseCannotMixSqbAndWildcardInSelectList",
1141
+ "Cannot mix [] and * in the same expression in a SELECT list in SQL expression.",
1142
+ 400
1143
+ ],
1144
+ ParseInvalidContextForWildcardInSelectList: [
1145
+ "ParseInvalidContextForWildcardInSelectList",
1146
+ "Invalid use of * in SELECT list in the SQL expression.",
1147
+ 400
1148
+ ],
1149
+ IncorrectSQLFunctionArgumentType: [
1150
+ "IncorrectSqlFunctionArgumentType",
1151
+ "Incorrect type of arguments in function call in the SQL expression.",
1152
+ 400
1153
+ ],
1154
+ ValueParseFailure: ["ValueParseFailure", "Time stamp parse failure in the SQL expression.", 400],
1155
+ EvaluatorInvalidArguments: [
1156
+ "EvaluatorInvalidArguments",
1157
+ "Incorrect number of arguments in the function call in the SQL expression.",
1158
+ 400
1159
+ ],
1160
+ IntegerOverflow: ["IntegerOverflow", "Int overflow or underflow in the SQL expression.", 400],
1161
+ LikeInvalidInputs: [
1162
+ "LikeInvalidInputs",
1163
+ "Invalid argument given to the LIKE clause in the SQL expression.",
1164
+ 400
1165
+ ],
1166
+ CastFailed: [
1167
+ "CastFailed",
1168
+ "Attempt to convert from one data type to another using CAST failed in the SQL expression.",
1169
+ 400
1170
+ ],
1171
+ InvalidCast: [
1172
+ "InvalidCast",
1173
+ "Attempt to convert from one data type to another using CAST failed in the SQL expression.",
1174
+ 400
1175
+ ],
1176
+ EvaluatorInvalidTimestampFormatPattern: [
1177
+ "EvaluatorInvalidTimestampFormatPattern",
1178
+ "Time stamp format pattern requires additional fields in the SQL expression.",
1179
+ 400
1180
+ ],
1181
+ EvaluatorInvalidTimestampFormatPatternSymbolForParsing: [
1182
+ "EvaluatorInvalidTimestampFormatPatternSymbolForParsing",
1183
+ "Time stamp format pattern contains a valid format symbol that cannot be applied to time stamp parsing in the SQL expression.",
1184
+ 400
1185
+ ],
1186
+ EvaluatorTimestampFormatPatternDuplicateFields: [
1187
+ "EvaluatorTimestampFormatPatternDuplicateFields",
1188
+ "Time stamp format pattern contains multiple format specifiers representing the time stamp field in the SQL expression.",
1189
+ 400
1190
+ ],
1191
+ EvaluatorTimestampFormatPatternHourClockAmPmMismatch: [
1192
+ "EvaluatorUnterminatedTimestampFormatPatternToken",
1193
+ "Time stamp format pattern contains unterminated token in the SQL expression.",
1194
+ 400
1195
+ ],
1196
+ EvaluatorUnterminatedTimestampFormatPatternToken: [
1197
+ "EvaluatorInvalidTimestampFormatPatternToken",
1198
+ "Time stamp format pattern contains an invalid token in the SQL expression.",
1199
+ 400
1200
+ ],
1201
+ EvaluatorInvalidTimestampFormatPatternToken: [
1202
+ "EvaluatorInvalidTimestampFormatPatternToken",
1203
+ "Time stamp format pattern contains an invalid token in the SQL expression.",
1204
+ 400
1205
+ ],
1206
+ EvaluatorInvalidTimestampFormatPatternSymbol: [
1207
+ "EvaluatorInvalidTimestampFormatPatternSymbol",
1208
+ "Time stamp format pattern contains an invalid symbol in the SQL expression.",
1209
+ 400
1210
+ ],
1211
+ EvaluatorBindingDoesNotExist: [
1212
+ "ErrEvaluatorBindingDoesNotExist",
1213
+ "A column name or a path provided does not exist in the SQL expression",
1214
+ 400
1215
+ ],
1216
+ MissingHeaders: [
1217
+ "MissingHeaders",
1218
+ "Some headers in the query are missing from the file. Check the file and try again.",
1219
+ 400
1220
+ ],
1221
+ InvalidColumnIndex: [
1222
+ "InvalidColumnIndex",
1223
+ "The column index is invalid. Please check the service documentation and try again.",
1224
+ 400
1225
+ ],
1226
+ InvalidDecompressedSize: [
1227
+ "XMinioInvalidDecompressedSize",
1228
+ "The data provided is unfit for decompression",
1229
+ 400
1230
+ ],
1231
+ AddUserInvalidArgument: [
1232
+ "XMinioInvalidIAMCredentials",
1233
+ "Credential is not allowed to be same as admin access key",
1234
+ 403
1235
+ ],
1236
+ AdminResourceInvalidArgument: [
1237
+ "XMinioInvalidResource",
1238
+ "Policy, user or group names are not allowed to begin or end with space characters",
1239
+ 400
1240
+ ],
1241
+ AdminAccountNotEligible: [
1242
+ "XMinioInvalidIAMCredentials",
1243
+ "The administrator key is not eligible for this operation",
1244
+ 403
1245
+ ],
1246
+ AccountNotEligible: [
1247
+ "XMinioInvalidIAMCredentials",
1248
+ "The account key is not eligible for this operation",
1249
+ 403
1250
+ ],
1251
+ AdminServiceAccountNotFound: [
1252
+ "XMinioInvalidIAMCredentials",
1253
+ "The specified service account is not found",
1254
+ 404
1255
+ ],
1256
+ PostPolicyConditionInvalidFormat: [
1257
+ "PostPolicyInvalidKeyName",
1258
+ "Invalid according to Policy: Policy Condition failed",
1259
+ 403
1260
+ ],
1261
+ InvalidChecksum: ["InvalidArgument", "Invalid checksum provided.", 400],
1262
+ LambdaARNInvalid: ["LambdaARNInvalid", "The specified lambda ARN is invalid", 400],
1263
+ LambdaARNNotFound: ["LambdaARNNotFound", "The specified lambda ARN does not exist", 404],
1264
+ PolicyAlreadyAttached: [
1265
+ "XMinioPolicyAlreadyAttached",
1266
+ "The specified policy is already attached.",
1267
+ 409
1268
+ ],
1269
+ PolicyNotAttached: ["XMinioPolicyNotAttached", "The specified policy is not found.", 404],
1270
+ InvalidAttributeName: ["InvalidArgument", "Invalid attribute name specified.", 400],
1271
+ AdminLDAPNotEnabled: [
1272
+ "XMinioLDAPNotEnabled",
1273
+ "LDAP is not enabled. LDAP must be enabled to make LDAP requests.",
1274
+ 501
1275
+ ],
1276
+ AdminLDAPExpectedLoginName: [
1277
+ "XMinioLDAPExpectedLoginName",
1278
+ "Expected LDAP short username but was given full DN.",
1279
+ 400
1280
+ ],
1281
+ AdminInvalidGroupName: ["XMinioInvalidGroupName", "The group name is invalid.", 400],
1282
+ AddUserValidUTF: ["XMinioInvalidUTF", "Invalid UTF-8 character detected.", 400]
1283
+ };
1284
+
1285
+ // src/errors.ts
1286
+ var S3Error = class extends Error {
1287
+ constructor(errorName, options = {}) {
1288
+ const [code, message, status] = MINIO_ERRORS[errorName];
1289
+ super(options.message ?? message);
1290
+ this.errorName = errorName;
1291
+ this.options = options;
1292
+ this.code = options.code ?? code;
1293
+ this.status = options.status ?? status;
1294
+ }
1295
+ errorName;
1296
+ options;
1297
+ code;
1298
+ status;
1299
+ };
1300
+ var fail = (name, options) => {
1301
+ throw new S3Error(name, options);
1302
+ };
1303
+
1304
+ // src/auth.ts
1305
+ var SIGN_V4 = "AWS4-HMAC-SHA256";
1306
+ var EMPTY_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
1307
+ var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
1308
+ var STREAMING_PAYLOAD = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
1309
+ var STREAMING_PAYLOAD_TRAILER = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD-TRAILER";
1310
+ var STREAMING_UNSIGNED_TRAILER = "STREAMING-UNSIGNED-PAYLOAD-TRAILER";
1311
+ var MAX_SKEW_MS = 15 * 60 * 1e3;
1312
+ var encoder = new TextEncoder();
1313
+ var hex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((value) => value.toString(16).padStart(2, "0")).join("");
1314
+ var sha256Hex = async (data) => hex(
1315
+ await crypto.subtle.digest(
1316
+ "SHA-256",
1317
+ typeof data === "string" ? encoder.encode(data) : data
1318
+ )
1319
+ );
1320
+ var hmacRaw = async (hash, key, value) => {
1321
+ const imported = await crypto.subtle.importKey(
1322
+ "raw",
1323
+ key,
1324
+ { name: "HMAC", hash },
1325
+ false,
1326
+ ["sign"]
1327
+ );
1328
+ return new Uint8Array(await crypto.subtle.sign("HMAC", imported, encoder.encode(value)));
1329
+ };
1330
+ var hmac256 = (key, value) => hmacRaw("SHA-256", key, value);
1331
+ var uriEncode = (value, keepSlash = false) => {
1332
+ let out = "";
1333
+ for (const byte of encoder.encode(value)) {
1334
+ const char = String.fromCharCode(byte);
1335
+ if (/[A-Za-z0-9\-_.~]/.test(char) || keepSlash && char === "/") out += char;
1336
+ else out += `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
1337
+ }
1338
+ return out;
1339
+ };
1340
+ var canonicalQuery = (pairs) => {
1341
+ const keys = [...new Set(pairs.map(([name]) => name))].sort();
1342
+ return keys.flatMap(
1343
+ (key) => pairs.filter(([name]) => name === key).map(([, value]) => `${uriEncode(key)}=${uriEncode(value)}`)
1344
+ ).join("&");
1345
+ };
1346
+ var isSignatureV4 = (headers) => (headers.get("authorization") ?? "").startsWith(SIGN_V4);
1347
+ var isSignatureV2 = (headers) => {
1348
+ const value = headers.get("authorization") ?? "";
1349
+ return value.startsWith("AWS") && !value.startsWith(SIGN_V4);
1350
+ };
1351
+ var isPresignedV4 = (query) => query.has("X-Amz-Credential");
1352
+ var isPresignedV2 = (query) => query.has("AWSAccessKeyId");
1353
+ var isPostPolicy = (method, headers) => method === "POST" && (headers.get("content-type") ?? "").split(";")[0]?.trim().toLowerCase() === "multipart/form-data";
1354
+ var authType = (method, headers, query) => {
1355
+ const sha = headers.get("x-amz-content-sha256");
1356
+ if (isSignatureV2(headers)) return "signed-v2";
1357
+ if (isPresignedV2(query)) return "presigned-v2";
1358
+ if (sha === STREAMING_PAYLOAD && method === "PUT") return "streaming-signed";
1359
+ if (sha === STREAMING_PAYLOAD_TRAILER && method === "PUT") return "streaming-signed-trailer";
1360
+ if (sha === STREAMING_UNSIGNED_TRAILER && method === "PUT") return "streaming-unsigned-trailer";
1361
+ if (isSignatureV4(headers)) return "signed";
1362
+ if (isPresignedV4(query)) return "presigned";
1363
+ if ((headers.get("authorization") ?? "").startsWith("Bearer")) return "jwt";
1364
+ if (isPostPolicy(method, headers)) return "post-policy";
1365
+ if (query.has("Action")) return "sts";
1366
+ if (!headers.has("authorization")) return "anonymous";
1367
+ return "unknown";
1368
+ };
1369
+ var hasMultipleAuth = (method, headers, query) => [
1370
+ isSignatureV2(headers),
1371
+ isPresignedV2(query),
1372
+ isSignatureV4(headers),
1373
+ isPresignedV4(query),
1374
+ isPostPolicy(method, headers)
1375
+ ].filter(Boolean).length > 1;
1376
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
1377
+ var DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
1378
+ var utc = (year, month, day, hour = 0, minute = 0, second = 0) => {
1379
+ if (month < 1 || month > 12 || hour > 23 || minute > 59 || second > 59) return Number.NaN;
1380
+ const ms = Date.UTC(year, month - 1, day, hour, minute, second);
1381
+ const check = new Date(ms);
1382
+ return check.getUTCDate() === day && check.getUTCMonth() === month - 1 ? ms : Number.NaN;
1383
+ };
1384
+ var parseAmzDate = (value) => {
1385
+ const match = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/.exec(value);
1386
+ if (!match) return Number.NaN;
1387
+ const [, y, mo, d, h, mi, s] = match.map(Number);
1388
+ return utc(y, mo, d, h, mi, s);
1389
+ };
1390
+ var parseYyyymmdd = (value) => {
1391
+ const match = /^(\d{4})(\d{2})(\d{2})$/.exec(value);
1392
+ if (!match) return Number.NaN;
1393
+ const [, y, mo, d] = match.map(Number);
1394
+ return utc(y, mo, d);
1395
+ };
1396
+ var parseRfc1123 = (value) => {
1397
+ const match = /^([A-Z][a-z]{2}), (\d{2}) ([A-Z][a-z]{2}) (\d{4}) (\d{2}):(\d{2}):(\d{2}) (?:([A-Z]{3,5})|([+-])(\d{2})(\d{2}))$/.exec(
1398
+ value
1399
+ );
1400
+ if (!match || !DAYS.includes(match[1])) return Number.NaN;
1401
+ const month = MONTHS.indexOf(match[3]) + 1;
1402
+ if (!month) return Number.NaN;
1403
+ const ms = utc(
1404
+ Number(match[4]),
1405
+ month,
1406
+ Number(match[2]),
1407
+ Number(match[5]),
1408
+ Number(match[6]),
1409
+ Number(match[7])
1410
+ );
1411
+ if (match[9] === void 0) return ms;
1412
+ const offset = (Number(match[10]) * 60 + Number(match[11])) * 60 * 1e3;
1413
+ return match[9] === "+" ? ms - offset : ms + offset;
1414
+ };
1415
+ var parseAnyAmzDate = (value) => {
1416
+ const iso = parseAmzDate(value);
1417
+ return Number.isNaN(iso) ? parseRfc1123(value) : iso;
1418
+ };
1419
+ var checkAuthMiddleware = (auth, headers, now) => {
1420
+ if (auth === "unknown") fail("SignatureVersionNotSupported");
1421
+ if (!["signed", "signed-v2", "streaming-signed", "streaming-signed-trailer"].includes(auth))
1422
+ return;
1423
+ let date = Number.NaN;
1424
+ let found = false;
1425
+ for (const name of ["x-amz-date", "date"]) {
1426
+ const value = headers.get(name);
1427
+ if (!value) continue;
1428
+ found = true;
1429
+ date = parseAnyAmzDate(value);
1430
+ if (Number.isNaN(date)) fail("MalformedDate");
1431
+ break;
1432
+ }
1433
+ if (!found) fail("MissingDateHeader");
1434
+ if (Math.abs(now - date) > MAX_SKEW_MS) fail("RequestTimeTooSkewed");
1435
+ };
1436
+ var scopeOf = (credential) => `${credential.date}/${credential.region}/${credential.service}/${credential.request}`;
1437
+ var isValidRegion = (requestRegion, configured) => {
1438
+ if (!configured) return true;
1439
+ const normalize = (value) => value === "US" ? "" : value;
1440
+ return normalize(requestRegion) === normalize(configured);
1441
+ };
1442
+ var regionError = (region) => new S3Error("AuthorizationHeaderMalformed", {
1443
+ message: `The authorization header is malformed; the region is wrong; expecting '${region}'.`
1444
+ });
1445
+ var parseCredential = (element, region, serverRegion = region) => {
1446
+ const trimmed = element.trim();
1447
+ const equals = trimmed.indexOf("=");
1448
+ if (equals < 0) fail("MissingFields");
1449
+ if (trimmed.slice(0, equals) !== "Credential") fail("MissingCredTag");
1450
+ const elements = trimmed.slice(equals + 1).trim().replace(/\/+$/, "").split("/");
1451
+ if (elements.length < 5) fail("CredMalformed");
1452
+ const accessKey = elements.slice(0, -4).join("/");
1453
+ if (accessKey.length < 3) fail("InvalidAccessKeyID");
1454
+ const [date, scopeRegion, service, request] = elements.slice(-4);
1455
+ if (Number.isNaN(parseYyyymmdd(date))) fail("MalformedCredentialDate");
1456
+ if (!isValidRegion(scopeRegion, region || scopeRegion)) throw regionError(serverRegion);
1457
+ if (service !== "s3") fail("InvalidServiceS3");
1458
+ if (request !== "aws4_request") fail("InvalidRequestVersion");
1459
+ return { accessKey, date, region: scopeRegion, service, request };
1460
+ };
1461
+ var parseSignedHeaders = (element) => {
1462
+ const fields = element.trim().split("=");
1463
+ if (fields.length !== 2) fail("MissingFields");
1464
+ if (fields[0] !== "SignedHeaders") fail("MissingSignHeadersTag");
1465
+ if (!fields[1]) fail("MissingFields");
1466
+ return fields[1].split(";");
1467
+ };
1468
+ var parseSignature = (element) => {
1469
+ const fields = element.trim().split("=");
1470
+ if (fields.length !== 2) fail("MissingFields");
1471
+ if (fields[0] !== "Signature") fail("MissingSignTag");
1472
+ if (!fields[1]) fail("MissingFields");
1473
+ return fields[1];
1474
+ };
1475
+ var parseSignV4 = (raw, region, serverRegion) => {
1476
+ const first = raw.trim().split(",")[0] ?? "";
1477
+ const credentialElement = first.startsWith(SIGN_V4) ? first.slice(SIGN_V4.length) : first;
1478
+ const compact = raw.replace(/ /g, "");
1479
+ if (!compact) fail("AuthHeaderEmpty");
1480
+ if (!compact.startsWith(SIGN_V4)) fail("SignatureVersionNotSupported");
1481
+ const fields = compact.slice(SIGN_V4.length).trim().split(",");
1482
+ if (fields.length !== 3) fail("MissingFields");
1483
+ const credential = parseCredential(credentialElement.trim(), region, serverRegion);
1484
+ const signedNames = parseSignedHeaders(fields[1]);
1485
+ const signature = parseSignature(fields[2]);
1486
+ return { credential, signedNames, signature };
1487
+ };
1488
+ var signingKey = async (secret, date, region) => {
1489
+ let key = await hmac256(encoder.encode(`AWS4${secret}`), date);
1490
+ key = await hmac256(key, region);
1491
+ key = await hmac256(key, "s3");
1492
+ return hmac256(key, "aws4_request");
1493
+ };
1494
+ var trimAll = (value) => value.trim().replace(/\s+/g, " ");
1495
+ var extractSignedHeaders = (names, request) => {
1496
+ if (!names.includes("host")) fail("UnsignedHeaders");
1497
+ const out = /* @__PURE__ */ new Map();
1498
+ for (const name of names) {
1499
+ const lower = name.toLowerCase();
1500
+ const value = lower === "host" ? null : request.headers.get(lower);
1501
+ if (value !== null) out.set(lower, value);
1502
+ else if (lower !== "host" && request.query.has(name))
1503
+ out.set(lower, request.query.getAll(name).join(","));
1504
+ else if (name === "expect") out.set(lower, "100-continue");
1505
+ else if (name === "host") out.set(lower, request.host);
1506
+ else if (name === "transfer-encoding") out.set(lower, "");
1507
+ else if (name === "content-length") out.set(lower, request.headers.get("content-length") ?? "0");
1508
+ else fail("UnsignedHeaders");
1509
+ }
1510
+ return [...out].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
1511
+ };
1512
+ var checkMetaHeaders = (signed, request) => {
1513
+ const values = new Map(signed);
1514
+ for (const [name, value] of request.headers)
1515
+ if (name.startsWith("x-amz-meta-") && values.get(name) !== value) fail("UnsignedHeaders");
1516
+ };
1517
+ var canonicalRequest = (request, headers, query, payload) => [
1518
+ request.method,
1519
+ uriEncode(request.path, true),
1520
+ query,
1521
+ headers.map(([name, value]) => `${name}:${trimAll(value)}
1522
+ `).join(""),
1523
+ headers.map(([name]) => name).join(";"),
1524
+ payload
1525
+ ].join("\n");
1526
+ var stringToSign = async (canonical, stamp, scope) => [SIGN_V4, stamp, scope, await sha256Hex(canonical)].join("\n");
1527
+ var checkKey = (lookup, accessKey) => {
1528
+ const secret = lookup(accessKey);
1529
+ if (secret === void 0) fail("InvalidAccessKeyID");
1530
+ return secret;
1531
+ };
1532
+ var contentSha256 = (request, presigned) => {
1533
+ if (presigned)
1534
+ return request.query.get("X-Amz-Content-Sha256") ?? request.headers.get("x-amz-content-sha256") ?? UNSIGNED_PAYLOAD;
1535
+ return request.headers.get("x-amz-content-sha256") ?? EMPTY_SHA256;
1536
+ };
1537
+ var skipContentSha256 = (request, presigned) => {
1538
+ const value = presigned ? request.query.get("X-Amz-Content-Sha256") ?? request.headers.get("x-amz-content-sha256") : request.headers.get("x-amz-content-sha256");
1539
+ return value === null || value === UNSIGNED_PAYLOAD || value === STREAMING_UNSIGNED_TRAILER;
1540
+ };
1541
+ var verifyHeaderV4 = async (request, region, serverRegion, lookup, payload, options = {}) => {
1542
+ const { credential, signedNames, signature } = parseSignV4(
1543
+ request.headers.get("authorization") ?? "",
1544
+ region,
1545
+ serverRegion
1546
+ );
1547
+ if (options.streaming && request.headers.get("x-amz-content-sha256") !== payload)
1548
+ fail("ContentSHA256Mismatch");
1549
+ const headers = extractSignedHeaders(signedNames, request);
1550
+ const secret = checkKey(lookup, credential.accessKey);
1551
+ const stamp = request.headers.get("x-amz-date") || request.headers.get("date");
1552
+ if (!stamp) fail("MissingDateHeader");
1553
+ if (Number.isNaN(parseAmzDate(stamp))) fail("MalformedDate");
1554
+ const query = canonicalQuery([...request.query]);
1555
+ const canonical = canonicalRequest(request, headers, query, payload);
1556
+ const key = await signingKey(secret, credential.date, credential.region);
1557
+ const scope = scopeOf(credential);
1558
+ const expected = hex(await hmac256(key, await stringToSign(canonical, stamp, scope)));
1559
+ if (expected !== signature) fail("SignatureDoesNotMatch");
1560
+ const day = stamp.slice(0, 8);
1561
+ return {
1562
+ accessKey: credential.accessKey,
1563
+ seed: {
1564
+ signature: expected,
1565
+ key: day === credential.date ? key : await signingKey(secret, day, credential.region),
1566
+ scope: `${day}/${credential.region}/s3/aws4_request`,
1567
+ stamp
1568
+ }
1569
+ };
1570
+ };
1571
+ var PRESIGN_PARAMS = [
1572
+ "X-Amz-Algorithm",
1573
+ "X-Amz-Credential",
1574
+ "X-Amz-Signature",
1575
+ "X-Amz-Date",
1576
+ "X-Amz-SignedHeaders",
1577
+ "X-Amz-Expires"
1578
+ ];
1579
+ var DEFAULT_SIG_PARAMS = /* @__PURE__ */ new Set([
1580
+ "X-Amz-Content-Sha256",
1581
+ "X-Amz-Security-Token",
1582
+ "X-Amz-Algorithm",
1583
+ "X-Amz-Date",
1584
+ "X-Amz-Expires",
1585
+ "X-Amz-SignedHeaders",
1586
+ "X-Amz-Credential",
1587
+ "X-Amz-Signature"
1588
+ ]);
1589
+ var DURATION_UNITS = {
1590
+ ns: 1e-9,
1591
+ us: 1e-6,
1592
+ \u00B5s: 1e-6,
1593
+ ms: 1e-3,
1594
+ s: 1,
1595
+ m: 60,
1596
+ h: 3600
1597
+ };
1598
+ var parseExpires = (value) => {
1599
+ const text = `${value}s`;
1600
+ const match = /^([-+]?)((?:(?:\d+\.?\d*|\.\d+)(?:ns|us|µs|ms|s|m|h))+)$/.exec(text);
1601
+ if (!match) return Number.NaN;
1602
+ let total = 0;
1603
+ for (const part of match[2].matchAll(/(\d+\.?\d*|\.\d+)(ns|us|µs|ms|s|m|h)/g))
1604
+ total += Number(part[1]) * DURATION_UNITS[part[2]];
1605
+ return match[1] === "-" ? -total : total;
1606
+ };
1607
+ var verifyPresignV4 = async (request, region, serverRegion, lookup, now) => {
1608
+ const query = request.query;
1609
+ for (const name of PRESIGN_PARAMS) if (!query.has(name)) fail("InvalidQueryParams");
1610
+ if (query.get("X-Amz-Algorithm") !== SIGN_V4) fail("InvalidQuerySignatureAlgo");
1611
+ const credential = parseCredential(
1612
+ `Credential=${query.get("X-Amz-Credential")}`,
1613
+ region,
1614
+ serverRegion
1615
+ );
1616
+ const date = parseAmzDate(query.get("X-Amz-Date") ?? "");
1617
+ if (Number.isNaN(date)) fail("MalformedPresignedDate");
1618
+ const expires = parseExpires(query.get("X-Amz-Expires") ?? "");
1619
+ if (Number.isNaN(expires)) fail("MalformedExpires");
1620
+ if (expires < 0) fail("NegativeExpires");
1621
+ if (expires > 604800) fail("MaximumExpires");
1622
+ const signedNames = parseSignedHeaders(`SignedHeaders=${query.get("X-Amz-SignedHeaders")}`);
1623
+ parseSignature(`Signature=${query.get("X-Amz-Signature")}`);
1624
+ const secret = checkKey(lookup, credential.accessKey);
1625
+ const headers = extractSignedHeaders(signedNames, request);
1626
+ checkMetaHeaders(headers, request);
1627
+ if (date > now + MAX_SKEW_MS) fail("RequestNotReadyYet");
1628
+ if (now - date > expires * 1e3) fail("ExpiredPresignRequest");
1629
+ const rebuilt = [];
1630
+ const payload = contentSha256(request, true);
1631
+ if (query.get("X-Amz-Content-Sha256")) rebuilt.push(["X-Amz-Content-Sha256", payload]);
1632
+ rebuilt.push(
1633
+ ["X-Amz-Algorithm", SIGN_V4],
1634
+ ["X-Amz-Date", query.get("X-Amz-Date")],
1635
+ ["X-Amz-Expires", String(Math.trunc(expires))],
1636
+ ["X-Amz-SignedHeaders", signedNames.join(";")],
1637
+ ["X-Amz-Credential", `${credential.accessKey}/${scopeOf(credential)}`]
1638
+ );
1639
+ for (const [name, value] of rebuilt)
1640
+ if (name !== "X-Amz-Algorithm" && name !== "X-Amz-Content-Sha256" && query.get(name) !== value)
1641
+ fail("SignatureDoesNotMatch");
1642
+ const pairs = [...rebuilt, ...[...query].filter(([name]) => !DEFAULT_SIG_PARAMS.has(name))];
1643
+ const canonical = canonicalRequest(request, headers, canonicalQuery(pairs), payload);
1644
+ const key = await signingKey(secret, credential.date, credential.region);
1645
+ const expected = hex(
1646
+ await hmac256(
1647
+ key,
1648
+ await stringToSign(canonical, query.get("X-Amz-Date"), scopeOf(credential))
1649
+ )
1650
+ );
1651
+ if (expected !== query.get("X-Amz-Signature")) fail("SignatureDoesNotMatch");
1652
+ return { accessKey: credential.accessKey };
1653
+ };
1654
+ var requestAccessKeyV4 = (request, region, serverRegion, lookup) => {
1655
+ let credential;
1656
+ try {
1657
+ credential = parseCredential(
1658
+ `Credential=${request.query.get("X-Amz-Credential") ?? ""}`,
1659
+ region,
1660
+ serverRegion
1661
+ );
1662
+ } catch {
1663
+ const header = request.headers.get("authorization") ?? "";
1664
+ const raw = header.startsWith(SIGN_V4) ? header.slice(SIGN_V4.length) : header;
1665
+ const fields = raw.trim().split(",");
1666
+ if (fields.length !== 3) fail("MissingFields");
1667
+ credential = parseCredential(fields[0], region, serverRegion);
1668
+ }
1669
+ checkKey(lookup, credential.accessKey);
1670
+ return credential.accessKey;
1671
+ };
1672
+ var validContentMd5 = (headers) => {
1673
+ const value = headers.get("content-md5");
1674
+ if (value === null) return true;
1675
+ if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value) || !value)
1676
+ return false;
1677
+ return atob(value).length === 16;
1678
+ };
1679
+ var claimedAccessKey = (headers, query) => {
1680
+ const header = /Credential=([^/,\s]+)/.exec(headers.get("authorization") ?? "")?.[1];
1681
+ const presigned = (query.get("X-Amz-Credential") ?? "").split("/")[0];
1682
+ const v2 = /^AWS ([^:]+):/.exec(headers.get("authorization") ?? "")?.[1] ?? query.get("AWSAccessKeyId");
1683
+ return header ?? (presigned || void 0) ?? v2 ?? void 0;
1684
+ };
1685
+ var isHex = (value) => value.length % 2 === 0 && /^[0-9a-fA-F]*$/.test(value);
1686
+ var PUT_ACTIONS = /* @__PURE__ */ new Set(["PutObject", "UploadPart"]);
1687
+ var STREAMING_TYPES = [
1688
+ "streaming-signed",
1689
+ "streaming-signed-trailer",
1690
+ "streaming-unsigned-trailer"
1691
+ ];
1692
+ var MAX_OBJECT_SIZE = 5 * 1024 ** 4;
1693
+ var putPreflight = (op, auth, request) => {
1694
+ const { headers, query } = request;
1695
+ if (headers.has("x-amz-copy-source")) fail("InvalidCopySource");
1696
+ if (!validContentMd5(headers)) fail("InvalidDigest");
1697
+ let size = Number(headers.get("content-length") ?? "0");
1698
+ const decoded = headers.get("x-amz-decoded-content-length");
1699
+ if (STREAMING_TYPES.includes(auth) && decoded !== null) {
1700
+ if (decoded === "") fail("MissingContentLength");
1701
+ if (!/^[+-]?\d+$/.test(decoded))
1702
+ fail("InternalError", {
1703
+ message: `We encountered an internal error, please try again.: cause(strconv.ParseInt: parsing ${JSON.stringify(decoded)}: invalid syntax)`
1704
+ });
1705
+ size = Number(decoded);
1706
+ }
1707
+ if (size === -1) fail("MissingContentLength");
1708
+ if (op === "UploadPart") {
1709
+ const part = query.get("partNumber") ?? "";
1710
+ if (!/^[+-]?\d+$/.test(part) || Number(part) <= 0 || BigInt(part) > 9223372036854775807n)
1711
+ fail("InvalidPart");
1712
+ }
1713
+ if (size > MAX_OBJECT_SIZE) fail("EntityTooLarge");
1714
+ if (op === "UploadPart" && Number(query.get("partNumber")) > 1e4) fail("InvalidMaxParts");
1715
+ };
1716
+ var checkPayloadHashFormat = (request, presigned, put) => {
1717
+ if (skipContentSha256(request, presigned)) return;
1718
+ if (put) {
1719
+ if (!isHex(contentSha256(request, presigned))) fail("ContentSHA256Mismatch");
1720
+ return;
1721
+ }
1722
+ if (presigned) {
1723
+ const value2 = request.query.get("X-Amz-Content-Sha256");
1724
+ if (value2 && !isHex(value2)) fail("ContentSHA256Mismatch");
1725
+ return;
1726
+ }
1727
+ const value = request.headers.get("x-amz-content-sha256");
1728
+ if (value !== null && (!value || !isHex(value))) fail("ContentSHA256Mismatch");
1729
+ };
1730
+ var anonymous = { identity: { anonymous: true } };
1731
+ var authenticate = async (input) => {
1732
+ const { op, auth, signed, region, lookup, now, strict } = input;
1733
+ if (!strict) {
1734
+ if (auth === "unknown") fail("SignatureVersionNotSupported");
1735
+ if (auth === "presigned") {
1736
+ const verified = await verifyPresignV4(signed, region, region, lookup, now);
1737
+ return { identity: { anonymous: false, accessKey: verified.accessKey }, verified };
1738
+ }
1739
+ const accessKey = claimedAccessKey(signed.headers, signed.query);
1740
+ return { identity: { anonymous: false, ...accessKey ? { accessKey } : {} } };
1741
+ }
1742
+ const { verifyV2, requestAccessKeyV2 } = await import("./auth-v2-YGYT7VVQ.js");
1743
+ if (op === "PostObject" && auth === "post-policy") return { identity: { anonymous: false } };
1744
+ if (op === "DeleteObjects") {
1745
+ const md5 = signed.headers.get("content-md5");
1746
+ if (md5 && !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(md5))
1747
+ fail("MissingContentMD5");
1748
+ }
1749
+ if (PUT_ACTIONS.has(op)) {
1750
+ putPreflight(op, auth, signed);
1751
+ let accessKey;
1752
+ switch (auth) {
1753
+ case "unknown":
1754
+ fail("SignatureVersionNotSupported");
1755
+ break;
1756
+ case "signed-v2":
1757
+ case "presigned-v2":
1758
+ accessKey = requestAccessKeyV2(signed, lookup);
1759
+ break;
1760
+ case "signed":
1761
+ case "presigned":
1762
+ case "streaming-signed":
1763
+ case "streaming-signed-trailer":
1764
+ accessKey = requestAccessKeyV4(signed, region, region, lookup);
1765
+ break;
1766
+ case "streaming-unsigned-trailer":
1767
+ try {
1768
+ accessKey = requestAccessKeyV4(signed, region, region, lookup);
1769
+ } catch (error) {
1770
+ if (!(error instanceof S3Error && error.errorName === "MissingFields")) throw error;
1771
+ }
1772
+ break;
1773
+ }
1774
+ if (!accessKey) return anonymous;
1775
+ switch (auth) {
1776
+ case "streaming-signed":
1777
+ case "streaming-signed-trailer": {
1778
+ const payload = auth === "streaming-signed" ? STREAMING_PAYLOAD : STREAMING_PAYLOAD_TRAILER;
1779
+ const verified = await verifyHeaderV4(signed, region, region, lookup, payload, {
1780
+ streaming: true
1781
+ });
1782
+ return { identity: { anonymous: false, accessKey }, verified };
1783
+ }
1784
+ case "streaming-unsigned-trailer":
1785
+ if (signed.headers.get("authorization"))
1786
+ await verifyHeaderV4(signed, region, region, lookup, STREAMING_UNSIGNED_TRAILER);
1787
+ return { identity: { anonymous: false, accessKey } };
1788
+ case "signed-v2":
1789
+ case "presigned-v2":
1790
+ await verifyV2(signed, lookup, now, auth === "presigned-v2");
1791
+ return { identity: { anonymous: false, accessKey } };
1792
+ default: {
1793
+ const presigned = auth === "presigned";
1794
+ const verified = presigned ? await verifyPresignV4(signed, region, region, lookup, now) : await verifyHeaderV4(signed, region, region, lookup, contentSha256(signed, false));
1795
+ checkPayloadHashFormat(signed, presigned, true);
1796
+ return { identity: { anonymous: false, accessKey }, verified };
1797
+ }
1798
+ }
1799
+ }
1800
+ switch (auth) {
1801
+ case "unknown":
1802
+ case "streaming-signed":
1803
+ case "streaming-signed-trailer":
1804
+ case "streaming-unsigned-trailer":
1805
+ return fail("SignatureVersionNotSupported");
1806
+ case "signed-v2":
1807
+ case "presigned-v2": {
1808
+ const accessKey = await verifyV2(signed, lookup, now, auth === "presigned-v2");
1809
+ return { identity: { anonymous: false, accessKey } };
1810
+ }
1811
+ case "signed":
1812
+ case "presigned": {
1813
+ const scopeRegion = op === "GetBucketLocation" || op === "ListBuckets" ? "" : region;
1814
+ const presigned = auth === "presigned";
1815
+ const verified = presigned ? await verifyPresignV4(signed, scopeRegion, region, lookup, now) : await verifyHeaderV4(signed, scopeRegion, region, lookup, contentSha256(signed, false));
1816
+ if (!validContentMd5(signed.headers)) fail("InvalidDigest");
1817
+ checkPayloadHashFormat(signed, presigned, false);
1818
+ return { identity: { anonymous: false, accessKey: verified.accessKey }, verified };
1819
+ }
1820
+ default:
1821
+ return anonymous;
1822
+ }
1823
+ };
1824
+
1825
+ export {
1826
+ MINIO_ERRORS,
1827
+ S3Error,
1828
+ fail,
1829
+ SIGN_V4,
1830
+ EMPTY_SHA256,
1831
+ hex,
1832
+ sha256Hex,
1833
+ hmacRaw,
1834
+ hmac256,
1835
+ authType,
1836
+ hasMultipleAuth,
1837
+ checkAuthMiddleware,
1838
+ parseCredential,
1839
+ signingKey,
1840
+ checkKey,
1841
+ contentSha256,
1842
+ skipContentSha256,
1843
+ authenticate
1844
+ };
1845
+ //# sourceMappingURL=chunk-Y75YGK7R.js.map