lab7: при отказе S3 в credentials — внеочередное чтение секрета и повтор; Redis ACL api +decr (возврат слота лимита)

This commit is contained in:
2026-11-12 19:59:49 +03:00
parent 8041d5c02a
commit b862899b97
5 changed files with 140 additions and 4 deletions
+10
View File
@@ -74,6 +74,16 @@ func NewS3WithCreds(endpoint, region, bucket string, creds *credentials.Credenti
return &S3{client: c, bucket: bucket}, nil
}
// IsAuthError — S3 отверг credentials (ключ сменён или удалён). AccessDenied сюда не
// входит: это отказ политики по префиксу, повтор с тем же ключом его не исправит.
func IsAuthError(err error) bool {
var er minio.ErrorResponse
if !errors.As(err, &er) {
return false
}
return er.Code == "InvalidAccessKeyId" || er.Code == "SignatureDoesNotMatch"
}
func isNotFound(err error) bool {
code := minio.ToErrorResponse(err).Code
return code == "NoSuchKey" || code == "NotFound"