minio-hs-1.0.1: A Minio Haskell Library for Amazon S3 compatible cloud storage.

Safe HaskellNone
LanguageHaskell2010

Network.Minio.S3API

Contents

Synopsis

Documentation

type Region = Text #

Represents a region TODO: This could be a Sum Type with all defined regions for AWS.

getLocation :: Bucket -> Minio Region #

Fetch bucket location (region)

Listing buckets

getService :: Minio [BucketInfo] #

Fetch all buckets from the service.

Listing objects

listObjects' :: Bucket -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Int -> Minio ListObjectsResult #

List objects in a bucket matching prefix up to delimiter, starting from nextToken.

listObjectsV1' :: Bucket -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Int -> Minio ListObjectsV1Result #

List objects in a bucket matching prefix up to delimiter, starting from nextMarker.

Retrieving buckets

headBucket :: Bucket -> Minio Bool #

Query the object store if a given bucket exists.

Retrieving objects

getObject' :: Bucket -> Object -> Query -> [Header] -> Minio ([Header], ConduitM () ByteString Minio ()) #

GET an object from the service and return the response headers and a conduit source for the object content

headObject :: Bucket -> Object -> Minio ObjectInfo #

Get metadata of an object.

Creating buckets and objects

putBucket :: Bucket -> Region -> Minio () #

Creates a bucket via a PUT bucket call.

type ETag = Text #

A type alias to represent an Entity-Tag returned by S3-compatible APIs.

putObjectSingle :: Bucket -> Object -> [Header] -> Handle -> Int64 -> Int64 -> Minio ETag #

PUT an object into the service. This function performs a single PUT object call, and so can only transfer objects upto 5GiB.

copyObjectSingle :: Bucket -> Object -> SourceInfo -> [Header] -> Minio (ETag, UTCTime) #

Performs server-side copy of an object that is upto 5GiB in size. If the object is greater than 5GiB, this function throws the error returned by the server.

Multipart Upload APIs

type UploadId = Text #

A type alias to represent an upload-id for multipart upload

type PartTuple = (PartNumber, ETag) #

A type to represent a part-number and etag.

data Payload #

Represents different kinds of payload that are used with S3 API requests.

Instances

type PartNumber = Int16 #

A type alias to represent a part-number for multipart upload

newMultipartUpload :: Bucket -> Object -> [Header] -> Minio UploadId #

Create a new multipart upload.

putObjectPart :: Bucket -> Object -> UploadId -> PartNumber -> [Header] -> Payload -> Minio PartTuple #

PUT a part of an object as part of a multipart upload.

copyObjectPart :: DestinationInfo -> SourceInfo -> UploadId -> PartNumber -> [Header] -> Minio (ETag, UTCTime) #

Performs server-side copy of an object or part of an object as an upload part of an ongoing multi-part upload.

completeMultipartUpload :: Bucket -> Object -> UploadId -> [PartTuple] -> Minio ETag #

Complete a multipart upload.

abortMultipartUpload :: Bucket -> Object -> UploadId -> Minio () #

Abort a multipart upload.

listIncompleteUploads' :: Bucket -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Int -> Minio ListUploadsResult #

List incomplete multipart uploads.

data ListPartsResult #

Represents result from a listing of object parts of an ongoing multipart upload.

listIncompleteParts' :: Bucket -> Object -> UploadId -> Maybe Text -> Maybe Text -> Minio ListPartsResult #

List parts of an ongoing multipart upload.

Deletion APIs

deleteBucket :: Bucket -> Minio () #

DELETE a bucket from the service.

deleteObject :: Bucket -> Object -> Minio () #

DELETE an object from the service.

Presigned Operations

type UrlExpiry = Int #

Time to expire for a presigned URL. It interpreted as a number of seconds. The maximum duration that can be specified is 7 days.

makePresignedUrl :: UrlExpiry -> Method -> Maybe Bucket -> Maybe Object -> Maybe Region -> Query -> RequestHeaders -> Minio ByteString #

Generate a presigned URL. This function allows for advanced usage - for simple cases prefer the `presigned*Url` functions.

If region is Nothing, it is picked up from the connection information (no check of bucket existence is performed).

All extra query parameters or headers are signed, and therefore are required to be sent when the generated URL is actually used.

presignedPutObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString #

Generate a URL with authentication signature to PUT (upload) an object. Any extra headers if passed, are signed, and so they are required when the URL is used to upload data. This could be used, for example, to set user-metadata on the object.

For a list of possible headers to pass, please refer to the PUT object REST API AWS S3 documentation.

presignedGetObjectUrl :: Bucket -> Object -> UrlExpiry -> Query -> RequestHeaders -> Minio ByteString #

Generate a URL with authentication signature to GET (download) an object. All extra query parameters and headers passed here will be signed and are required when the generated URL is used. Query parameters could be used to change the response headers sent by the server. Headers can be used to set Etag match conditions among others.

For a list of possible request parameters and headers, please refer to the GET object REST API AWS S3 documentation.

presignedHeadObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString #

Generate a URL with authentication signature to make a HEAD request on an object. This is used to fetch metadata about an object. All extra headers passed here will be signed and are required when the generated URL is used.

For a list of possible headers to pass, please refer to the HEAD object REST API AWS S3 documentation.

ppCondBucket :: Bucket -> PostPolicyCondition #

Set the bucket name that the upload should use.

ppCondContentLengthRange :: Int64 -> Int64 -> PostPolicyCondition #

Set the content length range constraint with minimum and maximum byte count values.

ppCondContentType :: Text -> PostPolicyCondition #

Set the content-type header for the upload.

ppCondKey :: Object -> PostPolicyCondition #

Set the object name constraint for the upload.

ppCondKeyStartsWith :: Object -> PostPolicyCondition #

Set the object name prefix constraint for the upload.

ppCondSuccessActionStatus :: Int -> PostPolicyCondition #

Status code that the S3-server should send on a successful POST upload

data PostPolicy #

A PostPolicy is required to perform uploads via browser forms.

newPostPolicy :: UTCTime -> [PostPolicyCondition] -> Either PostPolicyError PostPolicy #

This function creates a PostPolicy after validating its arguments.

showPostPolicy :: PostPolicy -> ByteString #

Convert Post Policy to a string (e.g. for printing).

presignedPostPolicy :: PostPolicy -> Minio (ByteString, Map Text ByteString) #

Generate a presigned URL and POST policy to upload files via a browser. On success, this function returns a URL and POST form-data.

Bucket Policies

getBucketPolicy :: Bucket -> Minio Text #

Fetch the policy if any on a bucket.

setBucketPolicy :: Bucket -> Text -> Minio () #

Set a new policy on a bucket. As a special condition if the policy is empty then we treat it as policy DELETE operation.

Bucket Notifications

data Notification #

A data-type to represent bucket notification configuration. It is a collection of queue, topic or lambda function configurations. The structure of the types follow closely the XML representation described at https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTnotification.html

data NotificationConfig #

A data-type representing the configuration for a particular notification system. It could represent a Queue, Topic or Lambda Function configuration.

Constructors

NotificationConfig 

Fields

type Arn = Text #

data Filter #

Constructors

Filter 

Fields

Instances

Eq Filter # 

Methods

(==) :: Filter -> Filter -> Bool #

(/=) :: Filter -> Filter -> Bool #

Show Filter # 
Default Filter # 

Methods

def :: Filter #

data FilterRule #

A filter rule that can act based on the suffix or prefix of an object. As an example, let's create two filter rules:

let suffixRule = FilterRule "suffix" ".jpg"
let prefixRule = FilterRule "prefix" "images/"

The suffixRule restricts the notification to be triggered only for objects having a suffix of ".jpg", and the prefixRule restricts it to objects having a prefix of "images/".

Constructors

FilterRule 

Fields

getBucketNotification :: Bucket -> Minio Notification #

Retrieve the notification configuration on a bucket.

putBucketNotification :: Bucket -> Notification -> Minio () #

Set the notification configuration on a bucket.

removeAllBucketNotification :: Bucket -> Minio () #

Remove all notifications configured on a bucket.