Example #1
0
 private void ValidateSecretKey(byte[] input, ValidationContext <IAccessKey> context)
 {
     if (!_inputValidator.TryValidateAccessKey(input, out ValidationStatus status, out string?allowed))
     {
         context.AddFailure("Invalid secret key: " + ValidationMessages.GetMessage(status, allowed));
     }
 }
Example #2
0
 private void ValidateBucketName(string input, ValidationContext <T> context)
 {
     if (!_validator.TryValidateBucketName(input, _cfg.BucketNameValidationMode, out ValidationStatus status, out string?allowed))
     {
         context.AddFailure("Invalid bucket name: " + ValidationMessages.GetMessage(status, allowed));
     }
 }
Example #3
0
 private void ValidateKeyId(string input, ValidationContext <IAccessKey> context)
 {
     if (!_inputValidator.TryValidateKeyId(input, out ValidationStatus status, out string?allowed))
     {
         context.AddFailure("Invalid key id: " + ValidationMessages.GetMessage(status, allowed));
     }
 }
Example #4
0
 private void ValidateObjectKey(string input, ValidationContext <T> context)
 {
     if (!_validator.TryValidateObjectKey(input, _cfg.ObjectKeyValidationMode, out ValidationStatus status, out string?allowed))
     {
         context.AddFailure("Invalid object key: " + ValidationMessages.GetMessage(status, allowed));
     }
 }
Example #5
0
    public static void ValidateKeyIdAndThrow(this IInputValidator validator, string?keyId)
    {
        if (validator.TryValidateKeyId(keyId, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid key id: " + ValidationMessages.GetMessage(status, message), nameof(keyId));
    }
Example #6
0
    public static void ValidateBucketName(this IInputValidator validator, BucketNameValidationMode mode, string?bucketName)
    {
        if (validator.TryValidateBucketName(bucketName, mode, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid bucket name: " + ValidationMessages.GetMessage(status, message), nameof(bucketName));
    }
Example #7
0
    public static void ValidateObjectKey(this IInputValidator validator, string?objectKey, ObjectKeyValidationMode mode)
    {
        if (validator.TryValidateObjectKey(objectKey, mode, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid object key: " + ValidationMessages.GetMessage(status, message), nameof(objectKey));
    }
Example #8
0
    public static void ValidateAccessKeyAndThrow(this IInputValidator validator, byte[]?accessKey)
    {
        if (validator.TryValidateAccessKey(accessKey, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid access key: " + ValidationMessages.GetMessage(status, message), nameof(accessKey));
    }