public static Map validateParameters()

in teamcity-s3-sdk/src/main/java/jetbrains/buildServer/artifacts/s3/S3Util.java [79:106]


  public static Map<String, String> validateParameters(@NotNull final Map<String, String> params, final boolean acceptReferences) {
    final Map<String, String> invalids = new HashMap<>();
    if (StringUtil.isEmptyOrSpaces(getBucketName(params))) {
      invalids.put(beanPropertyNameForBucketName(), "S3 bucket name must not be empty");
    }
    final String pathPrefix = params.getOrDefault(S3_PATH_PREFIX_SETTING, "");
    if (!StringUtil.isEmptyOrSpaces(pathPrefix)) {
      if (pathPrefix.length() > OUT_MAX_PREFIX_LENGTH) {
        invalids.put(S3_PATH_PREFIX_SETTING, "Should be less than " + OUT_MAX_PREFIX_LENGTH + " characters");
      }
      if (!OUR_OBJECT_KEY_PATTERN.matcher(pathPrefix).matches()) {
        invalids.put(S3_PATH_PREFIX_SETTING, "Should match the regexp [" + OUR_OBJECT_KEY_PATTERN.pattern() + "]");
      }
    }
    final Pair<Long, String> partSizeValueWithError = parseMultipartUploadByteSetting(params.get(S3_MULTIPART_MINIMUM_UPLOAD_PART_SIZE));
    if (partSizeValueWithError.getSecond() != null) {
      invalids.put(S3_MULTIPART_MINIMUM_UPLOAD_PART_SIZE, "Invalid " + partSizeValueWithError.getSecond());
    }
    final Pair<Long, String> thresholdWithError = parseMultipartUploadByteSetting(params.get(S3_MULTIPART_UPLOAD_THRESHOLD));
    if (thresholdWithError.getSecond() != null) {
      invalids.put(S3_MULTIPART_UPLOAD_THRESHOLD, "Invalid " + thresholdWithError.getSecond());
    }

    if (!disablePathStyleAccess(params) && isAccelerateModeEnabled(params)) {
      invalids.put(S3_ENABLE_ACCELERATE_MODE, "Transfer Acceleration can only be used together with Virtual Host Addressing");
    }
    return invalids;
  }