public Optional get()

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


  public Optional<CephObject> get(String cephBucketName, String key) {
    log.info("Getting file with key {} from ceph bucket {}", key, cephBucketName);
    assertBucketExists(cephAmazonS3, cephBucketName);
    var doesContentExist = execute(() -> cephAmazonS3.doesObjectExist(cephBucketName, key));
    if (!doesContentExist) {
      log.info("File {} wasn't found in ceph bucket {}", key, cephBucketName);
      return Optional.empty();
    }
    var result = execute(() -> Optional.of(cephAmazonS3.getObject(cephBucketName, key)));
    log.info("File {} was found in ceph bucket {}", key, cephBucketName);
    return result.map(this::tpCephObject);
  }