Skip to content

Instantly share code, notes, and snippets.

@recursivecodes
Created December 19, 2018 15:05
Show Gist options
  • Save recursivecodes/36e84bb869c62c5fde131d3a3239ee82 to your computer and use it in GitHub Desktop.
Save recursivecodes/36e84bb869c62c5fde131d3a3239ee82 to your computer and use it in GitHub Desktop.
def getObject() {
def listObjectsResponse = listObjects()
GetObjectRequest getObjectRequest = GetObjectRequest.builder()
.namespaceName(namespaceName)
.bucketName(bucketName)
.objectName(listObjectsResponse.listObjects.objects.first().name)
.build()
GetObjectResponse getObjectResponse = objectClient.getObject(getObjectRequest)
def object = Util.writeInputStream(getObjectResponse.inputStream, getObjectResponse.contentType)
return [object: object, response: getObjectResponse]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment