Skip to content

Instantly share code, notes, and snippets.

@goeh
Created July 12, 2019 08:36
Show Gist options
  • Save goeh/75c3f5b8322eec92fdf070529848c4c2 to your computer and use it in GitHub Desktop.
Save goeh/75c3f5b8322eec92fdf070529848c4c2 to your computer and use it in GitHub Desktop.
Groovy script to test MinIO
@Grab('io.minio:minio:6.0.8')
import io.minio.MinioClient
def serviceUrl = "https://minioserver:9000"
def accessKey = "*****"
def secretKey = "*****"
def bucketName = "groovy-test"
def client = new MinioClient(serviceUrl, accessKey, secretKey)
if(!client.bucketExists(bucketName)) {
client.makeBucket(bucketName)
}
def input = new ByteArrayInputStream("Hello World!".getBytes("UTF-8"))
client.putObject(bucketName, "hello.txt", input, "text/plain")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment