public Optional getAsString()

in src/main/java/com/epam/digital/data/platform/integration/ceph/service/impl/CephServiceS3Impl.java [86:97]


  public Optional<String> getAsString(String cephBucketName, String key) {
    log.info("Getting content with key {} from ceph bucket {}", key, cephBucketName);
    assertBucketExists(cephAmazonS3, cephBucketName);
    var doesContentExist = execute(() -> cephAmazonS3.doesObjectExist(cephBucketName, key));
    if (Boolean.FALSE.equals(doesContentExist)) {
      log.warn("Content {} wasn't found in ceph bucket {}", key, cephBucketName);
      return Optional.empty();
    }
    var result = execute(() -> Optional.of(cephAmazonS3.getObjectAsString(cephBucketName, key)));
    log.info("Content {} was found in ceph bucket {}", key, cephBucketName);
    return result;
  }