All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.corbel.resources.rem.health.S3HealthCheck Maven / Gradle / Ivy

There is a newer version: 1.44.0
Show newest version
package io.corbel.resources.rem.health;

import com.amazonaws.services.s3.AmazonS3;
import com.codahale.metrics.health.HealthCheck;

public class S3HealthCheck extends HealthCheck {

	private final AmazonS3 amazonS3Client;
	private final String bucket;

	public S3HealthCheck(AmazonS3 amazonS3Client, String bucket) {
		this.amazonS3Client = amazonS3Client;
		this.bucket = bucket;
	}

	@Override
	protected Result check() throws Exception {
		if (amazonS3Client.doesBucketExist(bucket)) {
			return Result.healthy();
		} else {
			return Result.unhealthy("Bucket " + bucket + " not exists");
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy