Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data ConnectInfo = ConnectInfo {}
- awsCI :: ConnectInfo
- awsWithRegionCI :: Region -> Bool -> ConnectInfo
- minioPlayCI :: ConnectInfo
- minioCI :: Text -> Int -> Bool -> ConnectInfo
- data Minio a
- runMinio :: ConnectInfo -> Minio a -> IO (Either MinioErr a)
- def :: Default a => a
- type Bucket = Text
- makeBucket :: Bucket -> Maybe Region -> Minio ()
- removeBucket :: Bucket -> Minio ()
- bucketExists :: Bucket -> Minio Bool
- type Region = Text
- getLocation :: Bucket -> Minio Region
- data BucketInfo = BucketInfo {}
- listBuckets :: Minio [BucketInfo]
- data ObjectInfo = ObjectInfo {}
- listObjects :: Bucket -> Maybe Text -> Bool -> Producer Minio ObjectInfo
- listObjectsV1 :: Bucket -> Maybe Text -> Bool -> Producer Minio ObjectInfo
- type UploadId = Text
- data UploadInfo = UploadInfo {
- uiKey :: Object
- uiUploadId :: UploadId
- uiInitTime :: UTCTime
- uiSize :: Int64
- listIncompleteUploads :: Bucket -> Maybe Text -> Bool -> Producer Minio UploadInfo
- data ObjectPartInfo = ObjectPartInfo {
- opiNumber :: PartNumber
- opiETag :: ETag
- opiSize :: Int64
- opiModTime :: UTCTime
- listIncompleteParts :: Bucket -> Object -> UploadId -> Producer Minio ObjectPartInfo
- data Notification = Notification {}
- data NotificationConfig = NotificationConfig {}
- type Arn = Text
- data Event
- data Filter = Filter {}
- data FilterKey = FilterKey {
- fkKey :: FilterRules
- data FilterRules = FilterRules {
- frFilterRules :: [FilterRule]
- data FilterRule = FilterRule {}
- getBucketNotification :: Bucket -> Minio Notification
- putBucketNotification :: Bucket -> Notification -> Minio ()
- removeAllBucketNotification :: Bucket -> Minio ()
- type Object = Text
- fGetObject :: Bucket -> Object -> FilePath -> Minio ()
- fPutObject :: Bucket -> Object -> FilePath -> Minio ()
- putObject :: Bucket -> Object -> Producer Minio ByteString -> Maybe Int64 -> Minio ()
- getObject :: Bucket -> Object -> Minio (ResumableSource Minio ByteString)
- data CopyPartSource = CopyPartSource {}
- copyObject :: Bucket -> Object -> CopyPartSource -> Minio ()
- statObject :: Bucket -> Object -> Minio ObjectInfo
- removeObject :: Bucket -> Object -> Minio ()
- removeIncompleteUpload :: Bucket -> Object -> Minio ()
- type UrlExpiry = Int
- presignedPutObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString
- presignedGetObjectUrl :: Bucket -> Object -> UrlExpiry -> Query -> RequestHeaders -> Minio ByteString
- presignedHeadObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString
- data PostPolicy
- data PostPolicyError
- newPostPolicy :: UTCTime -> [PostPolicyCondition] -> Either PostPolicyError PostPolicy
- presignedPostPolicy :: PostPolicy -> Minio (ByteString, Map Text ByteString)
- showPostPolicy :: PostPolicy -> ByteString
- data PostPolicyCondition
- ppCondBucket :: Bucket -> PostPolicyCondition
- ppCondContentLengthRange :: Int64 -> Int64 -> PostPolicyCondition
- ppCondContentType :: Text -> PostPolicyCondition
- ppCondKey :: Object -> PostPolicyCondition
- ppCondKeyStartsWith :: Object -> PostPolicyCondition
- ppCondSuccessActionStatus :: Int -> PostPolicyCondition
- data MinioErr
- data MErrV
- = MErrVSinglePUTSizeExceeded Int64
- | MErrVPutSizeExceeded Int64
- | MErrVETagHeaderNotFound
- | MErrVInvalidObjectInfoResponse
- | MErrVInvalidSrcObjSpec Text
- | MErrVInvalidSrcObjByteRange (Int64, Int64)
- | MErrVCopyObjSingleNoRangeAccepted
- | MErrVRegionNotSupported Text
- | MErrVXmlParse Text
- | MErrVInvalidBucketName Text
- | MErrVInvalidObjectName Text
- | MErrVInvalidUrlExpiry Int
- data ServiceErr
Connecting to object storage
data ConnectInfo Source #
Connection Info data type. To create a ConnectInfo
value, use one
of the provided smart constructors or override fields of the
Default instance.
ConnectInfo | |
|
Eq ConnectInfo Source # | |
Show ConnectInfo Source # | |
Default ConnectInfo Source # | Connects to a Minio server located at |
awsCI :: ConnectInfo Source #
Default AWS ConnectInfo. Connects to "us-east-1". Credentials should be supplied before use, for e.g.:
awsCI { connectAccessKey = "my-access-key" , connectSecretKey = "my-secret-key" }
Connection helpers
awsWithRegionCI :: Region -> Bool -> ConnectInfo Source #
AWS ConnectInfo with a specified region. It can optionally disable the automatic discovery of a bucket's region via the Boolean argument.
awsWithRegionCI "us-west-1" False { connectAccessKey = "my-access-key" , connectSecretKey = "my-secret-key" }
This restricts all operations to the "us-west-1" region and does not perform any bucket location requests.
minioPlayCI :: ConnectInfo Source #
Minio Play Server ConnectInfo. Credentials are already filled in.
minioCI :: Text -> Int -> Bool -> ConnectInfo Source #
ConnectInfo for Minio server. Takes hostname, port and a Boolean to enable TLS.
minioCI "minio.example.com" 9000 True { connectAccessKey = "my-access-key" , connectSecretKey = "my-secret-key" }
This connects to a Minio server at the given hostname and port over HTTPS.
Minio Monad
The Minio monad provides connection-reuse, bucket-location caching, resource management and simpler error handling functionality. All actions on object storage are performed within this Monad.
runMinio :: ConnectInfo -> Minio a -> IO (Either MinioErr a) Source #
Run the Minio action and return the result or an error.
Bucket Operations
Creation, removal and querying
makeBucket :: Bucket -> Maybe Region -> Minio () Source #
Creates a new bucket in the object store. The Region can be optionally specified. If not specified, it will use the region configured in ConnectInfo, which is by default, the US Standard Region.
removeBucket :: Bucket -> Minio () Source #
Removes a bucket from the object store.
Represents a region TODO: This could be a Sum Type with all defined regions for AWS.
Listing
data BucketInfo Source #
BucketInfo returned for list buckets call
listBuckets :: Minio [BucketInfo] Source #
Lists buckets.
data ObjectInfo Source #
Represents information about an object.
listObjects :: Bucket -> Maybe Text -> Bool -> Producer Minio ObjectInfo Source #
List objects in a bucket matching the given prefix. If recurse is set to True objects matching prefix are recursively listed.
listObjectsV1 :: Bucket -> Maybe Text -> Bool -> Producer Minio ObjectInfo Source #
List objects in a bucket matching the given prefix. If recurse is set to True objects matching prefix are recursively listed.
data UploadInfo Source #
Represents information about a multipart upload.
UploadInfo | |
|
listIncompleteUploads :: Bucket -> Maybe Text -> Bool -> Producer Minio UploadInfo Source #
List incomplete uploads in a bucket matching the given prefix. If recurse is set to True incomplete uploads for the given prefix are recursively listed.
data ObjectPartInfo Source #
Represents information about an object part in an ongoing multipart upload.
ObjectPartInfo | |
|
listIncompleteParts :: Bucket -> Object -> UploadId -> Producer Minio ObjectPartInfo Source #
List object parts of an ongoing multipart upload for given bucket, object and uploadId.
Notifications
data Notification Source #
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 Source #
A data-type representing the configuration for a particular notification system. It could represent a Queue, Topic or Lambda Function configuration.
A data-type for events that can occur in the object storage server. Reference: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#supported-notification-event-types
data FilterRules Source #
data FilterRule Source #
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/".
getBucketNotification :: Bucket -> Minio Notification Source #
Retrieve the notification configuration on a bucket.
putBucketNotification :: Bucket -> Notification -> Minio () Source #
Set the notification configuration on a bucket.
removeAllBucketNotification :: Bucket -> Minio () Source #
Remove all notifications configured on a bucket.
Object Operations
File operations
fGetObject :: Bucket -> Object -> FilePath -> Minio () Source #
Fetch the object and write it to the given file safely. The object is first written to a temporary file in the same directory and then moved to the given path.
fPutObject :: Bucket -> Object -> FilePath -> Minio () Source #
Upload the given file to the given object.
Conduit-based streaming operations
putObject :: Bucket -> Object -> Producer Minio ByteString -> Maybe Int64 -> Minio () Source #
Put an object from a conduit source. The size can be provided if known; this helps the library select optimal part sizes to perform a multipart upload. If not specified, it is assumed that the object can be potentially 5TiB and selects multipart sizes appropriately.
getObject :: Bucket -> Object -> Minio (ResumableSource Minio ByteString) Source #
Get an object from the object store as a resumable source (conduit).
Server-side copying
data CopyPartSource Source #
CopyPartSource | |
|
copyObject :: Bucket -> Object -> CopyPartSource -> Minio () Source #
Perform a server-side copy operation to create an object with the given bucket and object name from the source specification in CopyPartSource. This function performs a multipart copy operation if the new object is to be greater than 5GiB in size.
Querying
statObject :: Bucket -> Object -> Minio ObjectInfo Source #
Get an object's metadata from the object store.
Object removal functions
removeIncompleteUpload :: Bucket -> Object -> Minio () Source #
Removes an ongoing multipart upload of an object.
Presigned Operations
Time to expire for a presigned URL. It interpreted as a number of seconds. The maximum duration that can be specified is 7 days.
presignedPutObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString Source #
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 Source #
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 Source #
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.
Utilities for POST (browser) uploads
data PostPolicy Source #
A PostPolicy is required to perform uploads via browser forms.
data PostPolicyError Source #
Possible validation errors when creating a PostPolicy.
newPostPolicy :: UTCTime -> [PostPolicyCondition] -> Either PostPolicyError PostPolicy Source #
This function creates a PostPolicy after validating its arguments.
presignedPostPolicy :: PostPolicy -> Minio (ByteString, Map Text ByteString) Source #
Generate a presigned URL and POST policy to upload files via a browser. On success, this function returns a URL and POST form-data.
showPostPolicy :: PostPolicy -> ByteString Source #
Convert Post Policy to a string (e.g. for printing).
Utilities to specify Post Policy conditions
data PostPolicyCondition Source #
Represents individual conditions in a Post Policy document.
ppCondBucket :: Bucket -> PostPolicyCondition Source #
Set the bucket name that the upload should use.
ppCondContentLengthRange :: Int64 -> Int64 -> PostPolicyCondition Source #
Set the content length range constraint with minimum and maximum byte count values.
ppCondContentType :: Text -> PostPolicyCondition Source #
Set the content-type header for the upload.
ppCondKey :: Object -> PostPolicyCondition Source #
Set the object name constraint for the upload.
ppCondKeyStartsWith :: Object -> PostPolicyCondition Source #
Set the object name prefix constraint for the upload.
ppCondSuccessActionStatus :: Int -> PostPolicyCondition Source #
Status code that the S3-server should send on a successful POST upload
Error handling
Data types representing various errors that may occur while working with an object storage service.
Errors thrown by the library
Various validation errors
data ServiceErr Source #
Errors returned by S3 compatible service