Copyright | (c) 2017-2023 MinIO Dev Team |
---|---|
License | Apache 2.0 |
Maintainer | MinIO Dev Team <dev@min.io> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Types and functions to conveniently access S3 compatible object storage servers like MinIO.
Synopsis
- data CredentialValue = CredentialValue {}
- credentialValueText :: CredentialValue -> (Text, Text, Maybe Text)
- newtype AccessKey = AccessKey {
- unAccessKey :: Text
- newtype SecretKey = SecretKey {}
- newtype SessionToken = SessionToken {}
- type CredentialLoader = IO (Maybe CredentialValue)
- fromAWSConfigFile :: CredentialLoader
- fromAWSEnv :: CredentialLoader
- fromMinioEnv :: CredentialLoader
- findFirst :: [CredentialLoader] -> IO (Maybe CredentialValue)
- data ConnectInfo
- setRegion :: Region -> ConnectInfo -> ConnectInfo
- setCreds :: CredentialValue -> ConnectInfo -> ConnectInfo
- setCredsFrom :: [CredentialLoader] -> ConnectInfo -> IO ConnectInfo
- isConnectInfoSecure :: ConnectInfo -> Bool
- disableTLSCertValidation :: ConnectInfo -> ConnectInfo
- data MinioConn
- mkMinioConn :: ConnectInfo -> Manager -> IO MinioConn
- minioPlayCI :: ConnectInfo
- awsCI :: ConnectInfo
- gcsCI :: ConnectInfo
- data STSAssumeRole = STSAssumeRole {}
- data STSAssumeRoleOptions = STSAssumeRoleOptions {}
- defaultSTSAssumeRoleOptions :: STSAssumeRoleOptions
- requestSTSCredential :: STSCredentialProvider p => p -> IO (CredentialValue, ExpiryTime)
- setSTSCredential :: STSCredentialProvider p => p -> ConnectInfo -> IO ConnectInfo
- newtype ExpiryTime = ExpiryTime {}
- class STSCredentialProvider p
- data Minio a
- runMinioWith :: MinioConn -> Minio a -> IO (Either MinioErr a)
- runMinio :: ConnectInfo -> Minio a -> IO (Either MinioErr a)
- runMinioResWith :: MinioConn -> Minio a -> ResourceT IO (Either MinioErr a)
- runMinioRes :: ConnectInfo -> Minio a -> ResourceT IO (Either MinioErr 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]
- listObjects :: Bucket -> Maybe Text -> Bool -> ConduitM () ListItem Minio ()
- listObjectsV1 :: Bucket -> Maybe Text -> Bool -> ConduitM () ListItem Minio ()
- data ListItem
- data ObjectInfo
- oiObject :: ObjectInfo -> Object
- oiModTime :: ObjectInfo -> UTCTime
- oiETag :: ObjectInfo -> ETag
- oiSize :: ObjectInfo -> Int64
- oiUserMetadata :: ObjectInfo -> HashMap Text Text
- oiMetadata :: ObjectInfo -> HashMap Text Text
- listIncompleteUploads :: Bucket -> Maybe Text -> Bool -> ConduitM () UploadInfo Minio ()
- type UploadId = Text
- data UploadInfo = UploadInfo {
- uiKey :: Object
- uiUploadId :: UploadId
- uiInitTime :: UTCTime
- uiSize :: Int64
- listIncompleteParts :: Bucket -> Object -> UploadId -> ConduitM () ObjectPartInfo Minio ()
- data ObjectPartInfo = ObjectPartInfo {
- opiNumber :: PartNumber
- opiETag :: ETag
- opiSize :: Int64
- opiModTime :: UTCTime
- getBucketNotification :: Bucket -> Minio Notification
- putBucketNotification :: Bucket -> Notification -> Minio ()
- removeAllBucketNotification :: Bucket -> Minio ()
- data Notification = Notification {}
- defaultNotification :: Notification
- data NotificationConfig = NotificationConfig {}
- type Arn = Text
- data Event
- newtype Filter = Filter {}
- defaultFilter :: Filter
- newtype FilterKey = FilterKey {
- fkKey :: FilterRules
- defaultFilterKey :: FilterKey
- newtype FilterRules = FilterRules {
- frFilterRules :: [FilterRule]
- defaultFilterRules :: FilterRules
- data FilterRule = FilterRule {}
- type Object = Text
- fGetObject :: Bucket -> Object -> FilePath -> GetObjectOptions -> Minio ()
- fPutObject :: Bucket -> Object -> FilePath -> PutObjectOptions -> Minio ()
- putObject :: Bucket -> Object -> ConduitM () ByteString Minio () -> Maybe Int64 -> PutObjectOptions -> Minio ()
- data PutObjectOptions
- defaultPutObjectOptions :: PutObjectOptions
- pooContentType :: PutObjectOptions -> Maybe Text
- pooContentEncoding :: PutObjectOptions -> Maybe Text
- pooContentDisposition :: PutObjectOptions -> Maybe Text
- pooContentLanguage :: PutObjectOptions -> Maybe Text
- pooCacheControl :: PutObjectOptions -> Maybe Text
- pooStorageClass :: PutObjectOptions -> Maybe Text
- pooUserMetadata :: PutObjectOptions -> [(Text, Text)]
- pooNumThreads :: PutObjectOptions -> Maybe Word
- pooSSE :: PutObjectOptions -> Maybe SSE
- getObject :: Bucket -> Object -> GetObjectOptions -> Minio GetObjectResponse
- data GetObjectOptions
- defaultGetObjectOptions :: GetObjectOptions
- gooRange :: GetObjectOptions -> Maybe ByteRange
- gooIfMatch :: GetObjectOptions -> Maybe ETag
- gooIfNoneMatch :: GetObjectOptions -> Maybe ETag
- gooIfModifiedSince :: GetObjectOptions -> Maybe UTCTime
- gooIfUnmodifiedSince :: GetObjectOptions -> Maybe UTCTime
- gooSSECKey :: GetObjectOptions -> Maybe SSECKey
- data GetObjectResponse
- gorObjectInfo :: GetObjectResponse -> ObjectInfo
- gorObjectStream :: GetObjectResponse -> ConduitM () ByteString Minio ()
- copyObject :: DestinationInfo -> SourceInfo -> Minio ()
- data SourceInfo
- defaultSourceInfo :: SourceInfo
- srcBucket :: SourceInfo -> Text
- srcObject :: SourceInfo -> Text
- srcRange :: SourceInfo -> Maybe (Int64, Int64)
- srcIfMatch :: SourceInfo -> Maybe Text
- srcIfNoneMatch :: SourceInfo -> Maybe Text
- srcIfModifiedSince :: SourceInfo -> Maybe UTCTime
- srcIfUnmodifiedSince :: SourceInfo -> Maybe UTCTime
- data DestinationInfo
- defaultDestinationInfo :: DestinationInfo
- dstBucket :: DestinationInfo -> Text
- dstObject :: DestinationInfo -> Text
- statObject :: Bucket -> Object -> GetObjectOptions -> Minio ObjectInfo
- removeObject :: Bucket -> Object -> Minio ()
- removeIncompleteUpload :: Bucket -> Object -> Minio ()
- selectObjectContent :: Bucket -> Object -> SelectRequest -> Minio (ConduitT () EventMessage Minio ())
- data SelectRequest
- selectRequest :: Text -> InputSerialization -> OutputSerialization -> SelectRequest
- data InputSerialization
- defaultCsvInput :: InputSerialization
- linesJsonInput :: InputSerialization
- documentJsonInput :: InputSerialization
- defaultParquetInput :: InputSerialization
- setInputCSVProps :: CSVProp -> InputSerialization -> InputSerialization
- data CompressionType
- setInputCompressionType :: CompressionType -> SelectRequest -> SelectRequest
- data CSVProp
- recordDelimiter :: Text -> CSVProp
- fieldDelimiter :: Text -> CSVProp
- quoteCharacter :: Text -> CSVProp
- quoteEscapeCharacter :: Text -> CSVProp
- commentCharacter :: Text -> CSVProp
- allowQuotedRecordDelimiter :: CSVProp
- data FileHeaderInfo
- fileHeaderInfo :: FileHeaderInfo -> CSVProp
- data QuoteFields
- quoteFields :: QuoteFields -> CSVProp
- data OutputSerialization
- defaultCsvOutput :: OutputSerialization
- defaultJsonOutput :: OutputSerialization
- outputCSVFromProps :: CSVProp -> OutputSerialization
- outputJSONFromRecordDelimiter :: Text -> OutputSerialization
- setRequestProgressEnabled :: Bool -> SelectRequest -> SelectRequest
- getPayloadBytes :: MonadIO m => ConduitT EventMessage ByteString m ()
- data EventMessage
- data Progress = Progress {}
- type Stats = Progress
- mkSSECKey :: MonadThrow m => ByteString -> m SSECKey
- data SSECKey
- data SSE where
- presignedPutObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString
- presignedGetObjectUrl :: Bucket -> Object -> UrlExpiry -> Query -> RequestHeaders -> Minio ByteString
- presignedHeadObjectUrl :: Bucket -> Object -> UrlExpiry -> RequestHeaders -> Minio ByteString
- type UrlExpiry = Int
- newPostPolicy :: UTCTime -> [PostPolicyCondition] -> Either PostPolicyError PostPolicy
- presignedPostPolicy :: PostPolicy -> Minio (ByteString, HashMap Text ByteString)
- showPostPolicy :: PostPolicy -> ByteString
- data PostPolicy
- data PostPolicyError
- 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
- | MErrVJsonParse Text
- | MErrVInvalidHealPath
- | MErrVMissingCredentials
- | MErrVInvalidEncryptionKeyLength
- | MErrVStreamingBodyUnexpectedEOF
- | MErrVUnexpectedPayload
- | MErrVSTSEndpointNotFound
- data ServiceErr
Credentials
data CredentialValue Source #
Object storage credential data type. It has support for the optional SessionToken for using temporary credentials requested via STS.
The show instance for this type does not print the value of secrets for security.
Since: 1.7.0
Instances
Show CredentialValue Source # | |
Defined in Network.Minio.Credentials.Types showsPrec :: Int -> CredentialValue -> ShowS # show :: CredentialValue -> String # showList :: [CredentialValue] -> ShowS # | |
Eq CredentialValue Source # | |
Defined in Network.Minio.Credentials.Types (==) :: CredentialValue -> CredentialValue -> Bool # (/=) :: CredentialValue -> CredentialValue -> Bool # |
credentialValueText :: CredentialValue -> (Text, Text, Maybe Text) Source #
Convert a CredentialValue
to a text tuple. Use this to output the
credential to files or other programs.
Access Key type.
Secret Key type - has a show instance that does not print the value.
newtype SessionToken Source #
Session Token type - has a show instance that does not print the value.
Instances
IsString SessionToken Source # | |
Defined in Network.Minio.Credentials.Types fromString :: String -> SessionToken # | |
Monoid SessionToken Source # | |
Defined in Network.Minio.Credentials.Types mempty :: SessionToken # mappend :: SessionToken -> SessionToken -> SessionToken # mconcat :: [SessionToken] -> SessionToken # | |
Semigroup SessionToken Source # | |
Defined in Network.Minio.Credentials.Types (<>) :: SessionToken -> SessionToken -> SessionToken # sconcat :: NonEmpty SessionToken -> SessionToken # stimes :: Integral b => b -> SessionToken -> SessionToken # | |
Show SessionToken Source # | |
Defined in Network.Minio.Credentials.Types showsPrec :: Int -> SessionToken -> ShowS # show :: SessionToken -> String # showList :: [SessionToken] -> ShowS # | |
Eq SessionToken Source # | |
Defined in Network.Minio.Credentials.Types (==) :: SessionToken -> SessionToken -> Bool # (/=) :: SessionToken -> SessionToken -> Bool # |
Credential Loaders
Run actions that retrieve CredentialValue
s from the environment or
files or other custom sources.
type CredentialLoader = IO (Maybe CredentialValue) Source #
A CredentialLoader
is an action that may return a CredentialValue
.
Loaders may be chained together using findFirst
.
Since: 1.7.0
fromAWSConfigFile :: CredentialLoader Source #
This action returns a CredentialValue
populated from
~/.aws/credentials
fromAWSEnv :: CredentialLoader Source #
This action returns a CredentialValue
populated from AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
environment variables.
fromMinioEnv :: CredentialLoader Source #
This action returns a CredentialValue
populated from MINIO_ACCESS_KEY
and MINIO_SECRET_KEY
environment variables.
findFirst :: [CredentialLoader] -> IO (Maybe CredentialValue) Source #
Combines the given list of loaders, by calling each one in
order until a CredentialValue
is returned.
Connecting to object storage
data ConnectInfo Source #
Connection Info data type. To create a ConnectInfo
value,
enable the OverloadedStrings
language extension and use the
IsString
instance to provide a URL, for example:
let c :: ConnectInfo = "https://play.min.io"
Instances
IsString ConnectInfo Source # | |
Defined in Network.Minio.Data fromString :: String -> ConnectInfo # |
setRegion :: Region -> ConnectInfo -> ConnectInfo Source #
Set the S3 region parameter in the ConnectInfo
setCreds :: CredentialValue -> ConnectInfo -> ConnectInfo Source #
setCreds sets the given CredentialValue
in the ConnectInfo
.
setCredsFrom :: [CredentialLoader] -> ConnectInfo -> IO ConnectInfo Source #
setCredsFrom retrieves access credentials from the first action in the
given list that succeeds and sets it in the ConnectInfo
.
isConnectInfoSecure :: ConnectInfo -> Bool Source #
Check if the connection to object storage server is secure (i.e. uses TLS)
disableTLSCertValidation :: ConnectInfo -> ConnectInfo Source #
Disable TLS certificate validation completely! This makes TLS
insecure! Use only for testing with self-signed or temporary
certificates. Note that this option has no effect, if you provide
your own Manager in mkMinioConn
.
MinioConn holds connection info and a connection pool to allow for efficient resource re-use.
mkMinioConn :: ConnectInfo -> Manager -> IO MinioConn Source #
Given ConnectInfo
and a HTTP connection manager, create a
MinioConn
.
Connection helpers
These are helpers to construct ConnectInfo
values for common
cases.
minioPlayCI :: ConnectInfo Source #
MinIO Play Server ConnectInfo. Credentials are already filled in.
awsCI :: ConnectInfo Source #
Default AWS S3 ConnectInfo. Connects to "us-east-1". Credentials should be supplied before use.
gcsCI :: ConnectInfo Source #
Default Google Compute Storage ConnectInfo. Works only for "Simple Migration" use-case with interoperability mode enabled on GCP console. For more information - https://cloud.google.com/storage/docs/migrating
Credentials should be supplied before use.
STS Credential types
data STSAssumeRole Source #
Assume Role API argument.
Since: 1.7.0
STSAssumeRole | |
|
Instances
STSCredentialProvider STSAssumeRole Source # | |
Defined in Network.Minio.Credentials.AssumeRole retrieveSTSCredentials :: STSAssumeRole -> Endpoint -> Manager -> IO (CredentialValue, ExpiryTime) getSTSEndpoint :: STSAssumeRole -> Maybe Text |
data STSAssumeRoleOptions Source #
Options for STS Assume Role API.
STSAssumeRoleOptions | |
|
defaultSTSAssumeRoleOptions :: STSAssumeRoleOptions Source #
Default STS Assume Role options - all options are Nothing, except for duration which is set to 1 hour.
requestSTSCredential :: STSCredentialProvider p => p -> IO (CredentialValue, ExpiryTime) Source #
requestSTSCredential requests temporary credentials using the Security Token
Service API. The returned credential will include a populated SessionToken
and an ExpiryTime
.
setSTSCredential :: STSCredentialProvider p => p -> ConnectInfo -> IO ConnectInfo Source #
setSTSCredential
configures ConnectInfo
to retrieve temporary
credentials via the STS API on demand. It is automatically refreshed on
expiry.
newtype ExpiryTime Source #
ExpiryTime
represents a time at which a credential expires.
Instances
Show ExpiryTime Source # | |
Defined in Network.Minio.Credentials.Types showsPrec :: Int -> ExpiryTime -> ShowS # show :: ExpiryTime -> String # showList :: [ExpiryTime] -> ShowS # | |
Eq ExpiryTime Source # | |
Defined in Network.Minio.Credentials.Types (==) :: ExpiryTime -> ExpiryTime -> Bool # (/=) :: ExpiryTime -> ExpiryTime -> Bool # |
class STSCredentialProvider p Source #
Typeclass for STS credential providers.
Since: 1.7.0
retrieveSTSCredentials, getSTSEndpoint
Instances
STSCredentialProvider STSAssumeRole Source # | |
Defined in Network.Minio.Credentials.AssumeRole retrieveSTSCredentials :: STSAssumeRole -> Endpoint -> Manager -> IO (CredentialValue, ExpiryTime) getSTSEndpoint :: STSAssumeRole -> Maybe Text |
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.
The Minio Monad - all computations accessing object storage happens in it.
Instances
MonadIO Minio Source # | |
Defined in Network.Minio.Data | |
Applicative Minio Source # | |
Functor Minio Source # | |
Monad Minio Source # | |
MonadResource Minio Source # | |
Defined in Network.Minio.Data liftResourceT :: ResourceT IO a -> Minio a # | |
MonadUnliftIO Minio Source # | |
Defined in Network.Minio.Data | |
MonadReader MinioConn Minio Source # | |
runMinio :: ConnectInfo -> Minio a -> IO (Either MinioErr a) Source #
Run the Minio action and return the result or an error.
runMinioResWith :: MinioConn -> Minio a -> ResourceT IO (Either MinioErr a) Source #
Similar to runMinioWith
. Allows applications to allocate/release
its resources along side MinIO's internal resources.
runMinioRes :: ConnectInfo -> Minio a -> ResourceT IO (Either MinioErr a) Source #
Similar to runMinio
. Allows applications to allocate/release
its resources along side MinIO's internal resources.
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.
Listing buckets
data BucketInfo Source #
BucketInfo returned for list buckets call
Instances
Show BucketInfo Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> BucketInfo -> ShowS # show :: BucketInfo -> String # showList :: [BucketInfo] -> ShowS # | |
Eq BucketInfo Source # | |
Defined in Network.Minio.Data (==) :: BucketInfo -> BucketInfo -> Bool # (/=) :: BucketInfo -> BucketInfo -> Bool # |
listBuckets :: Minio [BucketInfo] Source #
Lists buckets.
Listing objects
listObjects :: Bucket -> Maybe Text -> Bool -> ConduitM () ListItem Minio () Source #
lists objects in a bucket
similar to a file system tree traversal.listObjects
bucket prefix recurse
If prefix
is not Nothing
, only items with the given prefix are
listed, otherwise items under the bucket are returned.
If recurse
is set to True
all directories under the prefix are
recursively traversed and only objects are returned.
If recurse
is set to False
, objects and directories immediately
under the given prefix are returned (no recursive traversal is
performed).
listObjectsV1 :: Bucket -> Maybe Text -> Bool -> ConduitM () ListItem Minio () Source #
Lists objects - similar to listObjects
, however uses the older
V1 AWS S3 API. Prefer listObjects
to this.
Represents a list output item - either an object or an object prefix (i.e. a directory).
data ObjectInfo Source #
Represents information about an object.
Instances
Show ObjectInfo Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> ObjectInfo -> ShowS # show :: ObjectInfo -> String # showList :: [ObjectInfo] -> ShowS # | |
Eq ObjectInfo Source # | |
Defined in Network.Minio.Data (==) :: ObjectInfo -> ObjectInfo -> Bool # (/=) :: ObjectInfo -> ObjectInfo -> Bool # |
oiObject :: ObjectInfo -> Object Source #
Object key
oiModTime :: ObjectInfo -> UTCTime Source #
Modification time of the object
oiETag :: ObjectInfo -> ETag Source #
ETag of the object
oiSize :: ObjectInfo -> Int64 Source #
Size of the object in bytes
oiUserMetadata :: ObjectInfo -> HashMap Text Text Source #
A map of user-metadata
pairs stored with an
object (keys will not
have the X-Amz-Meta-
prefix).
oiMetadata :: ObjectInfo -> HashMap Text Text Source #
A map of metadata key-value pairs (not including the user-metadata pairs)
Listing incomplete uploads
listIncompleteUploads :: Bucket -> Maybe Text -> Bool -> ConduitM () UploadInfo Minio () 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 UploadInfo Source #
Represents information about a multipart upload.
UploadInfo | |
|
Instances
Show UploadInfo Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> UploadInfo -> ShowS # show :: UploadInfo -> String # showList :: [UploadInfo] -> ShowS # | |
Eq UploadInfo Source # | |
Defined in Network.Minio.Data (==) :: UploadInfo -> UploadInfo -> Bool # (/=) :: UploadInfo -> UploadInfo -> Bool # |
listIncompleteParts :: Bucket -> Object -> UploadId -> ConduitM () ObjectPartInfo Minio () Source #
List object parts of an ongoing multipart upload for given bucket, object and uploadId.
data ObjectPartInfo Source #
Represents information about an object part in an ongoing multipart upload.
ObjectPartInfo | |
|
Instances
Show ObjectPartInfo Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> ObjectPartInfo -> ShowS # show :: ObjectPartInfo -> String # showList :: [ObjectPartInfo] -> ShowS # | |
Eq ObjectPartInfo Source # | |
Defined in Network.Minio.Data (==) :: ObjectPartInfo -> ObjectPartInfo -> Bool # (/=) :: ObjectPartInfo -> ObjectPartInfo -> Bool # |
Bucket Notifications
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.
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
Instances
Show Notification Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> Notification -> ShowS # show :: Notification -> String # showList :: [Notification] -> ShowS # | |
Eq Notification Source # | |
Defined in Network.Minio.Data (==) :: Notification -> Notification -> Bool # (/=) :: Notification -> Notification -> Bool # |
defaultNotification :: Notification Source #
The default notification configuration is empty.
data NotificationConfig Source #
A data-type representing the configuration for a particular notification system. It could represent a Queue, Topic or Lambda Function configuration.
Instances
Show NotificationConfig Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> NotificationConfig -> ShowS # show :: NotificationConfig -> String # showList :: [NotificationConfig] -> ShowS # | |
Eq NotificationConfig Source # | |
Defined in Network.Minio.Data (==) :: NotificationConfig -> NotificationConfig -> Bool # (/=) :: NotificationConfig -> NotificationConfig -> Bool # |
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
ObjectCreated | |
ObjectCreatedPut | |
ObjectCreatedPost | |
ObjectCreatedCopy | |
ObjectCreatedMultipartUpload | |
ObjectRemoved | |
ObjectRemovedDelete | |
ObjectRemovedDeleteMarkerCreated | |
ReducedRedundancyLostObject |
Filter data type - part of notification configuration
defaultFilter :: Filter Source #
defaultFilter is empty, used to create a notification configuration.
FilterKey contains FilterRules, and is part of a Filter.
Instances
defaultFilterKey :: FilterKey Source #
defaultFilterKey is empty, used to create notification configuration.
newtype FilterRules Source #
FilterRules represents a collection of FilterRule
s.
Instances
Show FilterRules Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> FilterRules -> ShowS # show :: FilterRules -> String # showList :: [FilterRules] -> ShowS # | |
Eq FilterRules Source # | |
Defined in Network.Minio.Data (==) :: FilterRules -> FilterRules -> Bool # (/=) :: FilterRules -> FilterRules -> Bool # |
defaultFilterRules :: FilterRules Source #
defaultFilterRules is empty, used to create notification configuration.
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/".
Instances
Show FilterRule Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> FilterRule -> ShowS # show :: FilterRule -> String # showList :: [FilterRule] -> ShowS # | |
Eq FilterRule Source # | |
Defined in Network.Minio.Data (==) :: FilterRule -> FilterRule -> Bool # (/=) :: FilterRule -> FilterRule -> Bool # |
Object Operations
File-based operations
fGetObject :: Bucket -> Object -> FilePath -> GetObjectOptions -> 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 -> PutObjectOptions -> Minio () Source #
Upload the given file to the given object.
Conduit-based streaming operations
putObject :: Bucket -> Object -> ConduitM () ByteString Minio () -> Maybe Int64 -> PutObjectOptions -> 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.
data PutObjectOptions Source #
Data type for options in PutObject call. Start with the empty
defaultPutObjectOptions
and use various the various poo*
accessors.
defaultPutObjectOptions :: PutObjectOptions Source #
Provide default PutObjectOptions
.
pooContentType :: PutObjectOptions -> Maybe Text Source #
Set a standard MIME type describing the format of the object.
pooContentEncoding :: PutObjectOptions -> Maybe Text Source #
Set what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
pooContentDisposition :: PutObjectOptions -> Maybe Text Source #
Set presentational information for the object.
pooContentLanguage :: PutObjectOptions -> Maybe Text Source #
Set to describe the language(s) intended for the audience.
pooCacheControl :: PutObjectOptions -> Maybe Text Source #
Set to specify caching behavior for the object along the request/reply chain.
pooStorageClass :: PutObjectOptions -> Maybe Text Source #
Set to STANDARD
or REDUCED_REDUNDANCY
depending on your
performance needs, storage class is STANDARD
by default (i.e
when Nothing is passed).
pooUserMetadata :: PutObjectOptions -> [(Text, Text)] Source #
Set user defined metadata to store with the object.
pooNumThreads :: PutObjectOptions -> Maybe Word Source #
Set number of worker threads used to upload an object.
getObject :: Bucket -> Object -> GetObjectOptions -> Minio GetObjectResponse Source #
Get an object from the object store.
data GetObjectOptions Source #
Data type for options when getting an object from the
service. Start with the empty defaultGetObjectOptions
and modify
it using the goo* functions.
defaultGetObjectOptions :: GetObjectOptions Source #
Provide default GetObjectOptions
.
gooRange :: GetObjectOptions -> Maybe ByteRange Source #
Set object's data of given offset begin and end, [ByteRangeFromTo 0 9] means first ten bytes of the source object.
gooIfMatch :: GetObjectOptions -> Maybe ETag Source #
Set matching ETag condition, GetObject which matches the following ETag.
gooIfNoneMatch :: GetObjectOptions -> Maybe ETag Source #
Set matching ETag none condition, GetObject which does not match the following ETag.
gooIfModifiedSince :: GetObjectOptions -> Maybe UTCTime Source #
Set object modified condition, GetObject modified since given time.
gooIfUnmodifiedSince :: GetObjectOptions -> Maybe UTCTime Source #
Set object unmodified condition, GetObject unmodified since given time.
gooSSECKey :: GetObjectOptions -> Maybe SSECKey Source #
Specify SSE-C key
data GetObjectResponse Source #
Data type returned by getObject
representing the object being
retrieved. Use the gor*
functions to access its contents.
gorObjectInfo :: GetObjectResponse -> ObjectInfo Source #
ObjectInfo of the object being retrieved.
gorObjectStream :: GetObjectResponse -> ConduitM () ByteString Minio () Source #
A conduit of the bytes of the object.
Server-side object copying
copyObject :: DestinationInfo -> SourceInfo -> Minio () Source #
Perform a server-side copy operation to create an object based on the destination specification in DestinationInfo from the source specification in SourceInfo. This function performs a multipart copy operation if the new object is to be greater than 5GiB in size.
data SourceInfo Source #
Represents source object in server-side copy object
Instances
Show SourceInfo Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> SourceInfo -> ShowS # show :: SourceInfo -> String # showList :: [SourceInfo] -> ShowS # | |
Eq SourceInfo Source # | |
Defined in Network.Minio.Data (==) :: SourceInfo -> SourceInfo -> Bool # (/=) :: SourceInfo -> SourceInfo -> Bool # |
defaultSourceInfo :: SourceInfo Source #
Provide a default for SourceInfo
srcBucket :: SourceInfo -> Text Source #
Bucket containing the source object
srcObject :: SourceInfo -> Text Source #
Source object key
srcIfMatch :: SourceInfo -> Maybe Text Source #
ETag condition on source - object is copied only if the source object's ETag matches this value.
srcIfNoneMatch :: SourceInfo -> Maybe Text Source #
ETag not match condition on source - object is copied if ETag does not match this value.
srcIfModifiedSince :: SourceInfo -> Maybe UTCTime Source #
Copy source object only if the source has been modified since this time.
srcIfUnmodifiedSince :: SourceInfo -> Maybe UTCTime Source #
Copy source object only if the source has been un-modified since this given time.
data DestinationInfo Source #
Represents destination object in server-side copy object
Instances
Show DestinationInfo Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> DestinationInfo -> ShowS # show :: DestinationInfo -> String # showList :: [DestinationInfo] -> ShowS # | |
Eq DestinationInfo Source # | |
Defined in Network.Minio.Data (==) :: DestinationInfo -> DestinationInfo -> Bool # (/=) :: DestinationInfo -> DestinationInfo -> Bool # |
defaultDestinationInfo :: DestinationInfo Source #
Provide a default for DestinationInfo
dstBucket :: DestinationInfo -> Text Source #
Destination bucket
dstObject :: DestinationInfo -> Text Source #
Destination object key
Querying object info
statObject :: Bucket -> Object -> GetObjectOptions -> Minio ObjectInfo Source #
Get an object's metadata from the object store. It accepts the same options as GetObject.
Object removal operations
removeIncompleteUpload :: Bucket -> Object -> Minio () Source #
Removes an ongoing multipart upload of an object.
Select Object Content with SQL
The selectObjectContent
allows querying CSV, JSON or Parquet
format objects in AWS S3 and in MinIO using SQL Select
statements. This allows significant reduction of data transfer
from object storage for computation-intensive tasks, as relevant
data is filtered close to the storage.
selectObjectContent :: Bucket -> Object -> SelectRequest -> Minio (ConduitT () EventMessage Minio ()) Source #
selectObjectContent calls the SelectRequest on the given object. It returns a Conduit of event messages that can be consumed by the client.
data SelectRequest Source #
SelectRequest represents the Select API call. Use the
selectRequest
function to create a value of this type.
Instances
Show SelectRequest Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> SelectRequest -> ShowS # show :: SelectRequest -> String # showList :: [SelectRequest] -> ShowS # | |
Eq SelectRequest Source # | |
Defined in Network.Minio.Data (==) :: SelectRequest -> SelectRequest -> Bool # (/=) :: SelectRequest -> SelectRequest -> Bool # |
selectRequest :: Text -> InputSerialization -> OutputSerialization -> SelectRequest Source #
selectRequest is used to build a SelectRequest
value. selectRequest query inputSer outputSer
represents a
SelectRequest with the SQL query text given by query
, the input
serialization settings (compression format and format information)
inputSer
and the output serialization settings outputSer
.
Input Serialization
data InputSerialization Source #
InputSerialization represents format information of the input
object being queried. Use one of the smart constructors such as
defaultCsvInput
as a starting value, and add compression info
using setInputCompressionType
Instances
Show InputSerialization Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> InputSerialization -> ShowS # show :: InputSerialization -> String # showList :: [InputSerialization] -> ShowS # | |
Eq InputSerialization Source # | |
Defined in Network.Minio.Data (==) :: InputSerialization -> InputSerialization -> Bool # (/=) :: InputSerialization -> InputSerialization -> Bool # |
defaultCsvInput :: InputSerialization Source #
defaultCsvInput returns InputSerialization with default CSV format, and without any compression setting.
linesJsonInput :: InputSerialization Source #
linesJsonInput returns InputSerialization with JSON line based format with no compression setting.
documentJsonInput :: InputSerialization Source #
documentJsonInput returns InputSerialization with JSON document based format with no compression setting.
defaultParquetInput :: InputSerialization Source #
defaultParquetInput returns InputSerialization with Parquet format, and no compression setting.
setInputCSVProps :: CSVProp -> InputSerialization -> InputSerialization Source #
Set the CSV format properties in the InputSerialization.
data CompressionType Source #
Data type representing the compression setting in a Select request.
Instances
Show CompressionType Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> CompressionType -> ShowS # show :: CompressionType -> String # showList :: [CompressionType] -> ShowS # | |
Eq CompressionType Source # | |
Defined in Network.Minio.Data (==) :: CompressionType -> CompressionType -> Bool # (/=) :: CompressionType -> CompressionType -> Bool # |
setInputCompressionType :: CompressionType -> SelectRequest -> SelectRequest Source #
setInputCompressionType sets the compression type for the input of the SelectRequest
CSV Format details
CSV format options such as delimiters and quote characters are specified using using the functions below. Options are combined monoidally.
CSVProp represents CSV format properties. It is built up using the Monoid instance.
recordDelimiter :: Text -> CSVProp Source #
Specify the CSV record delimiter property.
fieldDelimiter :: Text -> CSVProp Source #
Specify the CSV field delimiter property.
quoteCharacter :: Text -> CSVProp Source #
Specify the CSV quote character property.
quoteEscapeCharacter :: Text -> CSVProp Source #
Specify the CSV quote-escape character property.
commentCharacter :: Text -> CSVProp Source #
Specify the CSV comment character property. Lines starting with this character are ignored by the server.
allowQuotedRecordDelimiter :: CSVProp Source #
Allow quoted record delimiters inside a row using this property.
data FileHeaderInfo Source #
FileHeaderInfo specifies information about column headers for CSV format.
FileHeaderNone | No column headers are present |
FileHeaderUse | Headers are present and they should be used |
FileHeaderIgnore | Header are present, but should be ignored |
Instances
Show FileHeaderInfo Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> FileHeaderInfo -> ShowS # show :: FileHeaderInfo -> String # showList :: [FileHeaderInfo] -> ShowS # | |
Eq FileHeaderInfo Source # | |
Defined in Network.Minio.Data (==) :: FileHeaderInfo -> FileHeaderInfo -> Bool # (/=) :: FileHeaderInfo -> FileHeaderInfo -> Bool # |
fileHeaderInfo :: FileHeaderInfo -> CSVProp Source #
Specify the CSV file header info property.
data QuoteFields Source #
Represent the QuoteField setting.
Instances
Show QuoteFields Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> QuoteFields -> ShowS # show :: QuoteFields -> String # showList :: [QuoteFields] -> ShowS # | |
Eq QuoteFields Source # | |
Defined in Network.Minio.Data (==) :: QuoteFields -> QuoteFields -> Bool # (/=) :: QuoteFields -> QuoteFields -> Bool # |
quoteFields :: QuoteFields -> CSVProp Source #
quoteFields is an output serialization parameter
Output Serialization
data OutputSerialization Source #
OutputSerialization represents output serialization settings for
the SelectRequest. Use defaultCsvOutput
or defaultJsonOutput
as
a starting point.
Instances
Show OutputSerialization Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> OutputSerialization -> ShowS # show :: OutputSerialization -> String # showList :: [OutputSerialization] -> ShowS # | |
Eq OutputSerialization Source # | |
Defined in Network.Minio.Data (==) :: OutputSerialization -> OutputSerialization -> Bool # (/=) :: OutputSerialization -> OutputSerialization -> Bool # |
defaultCsvOutput :: OutputSerialization Source #
defaultCsvOutput returns OutputSerialization with default CSV format.
defaultJsonOutput :: OutputSerialization Source #
defaultJsonInput returns OutputSerialization with default JSON format.
outputCSVFromProps :: CSVProp -> OutputSerialization Source #
Set the CSV format properties in the OutputSerialization.
outputJSONFromRecordDelimiter :: Text -> OutputSerialization Source #
Set the output record delimiter for JSON format
Progress messages
setRequestProgressEnabled :: Bool -> SelectRequest -> SelectRequest Source #
setRequestProgressEnabled sets the flag for turning on progress messages when the Select response is being streamed back to the client.
Interpreting Select output
The conduit returned by selectObjectContent
returns values of
the EventMessage
data type. This returns the query output
messages formatted according to the chosen output serialization,
interleaved with progress messages (if enabled by
setRequestProgressEnabled
), and at the end a statistics
message.
If the application is interested in only the payload, then
getPayloadBytes
can be used. For example to simply print the
payload to stdout:
resultConduit <- selectObjectContent bucket object mySelectRequest runConduit $ resultConduit .| getPayloadBytes .| stdoutC
Note that runConduit, the connect operator (.|) and stdoutC are all from the "conduit" package.
getPayloadBytes :: MonadIO m => ConduitT EventMessage ByteString m () Source #
A helper conduit that returns only the record payload bytes.
data EventMessage Source #
An EventMessage represents each kind of message received from the server.
ProgressEventMessage Progress | |
StatsEventMessage Stats | |
RequestLevelErrorMessage | |
RecordPayloadEventMessage ByteString |
Instances
Show EventMessage Source # | |
Defined in Network.Minio.Data showsPrec :: Int -> EventMessage -> ShowS # show :: EventMessage -> String # showList :: [EventMessage] -> ShowS # | |
Eq EventMessage Source # | |
Defined in Network.Minio.Data (==) :: EventMessage -> EventMessage -> Bool # (/=) :: EventMessage -> EventMessage -> Bool # |
Represent the progress event returned in the Select response.
Server-Side Encryption Helpers
mkSSECKey :: MonadThrow m => ByteString -> m SSECKey Source #
Validates that the given ByteString is 32 bytes long and creates an encryption key.
Data type to represent an object encryption key. Create one using
the mkSSECKey
function.
Data type to represent Server-Side-Encryption settings
SSE :: SSE | Specifies SSE S3 encryption - server manages encryption keys |
SSEKMS :: ToJSON a => Maybe ByteString -> Maybe a -> SSE | Specifies that KMS service should be used. The first argument
to the constructor is the Key Id to be used by the server (if
not specified, the default KMS key id is used). The second
argument is the optional KMS context that must have a
|
SSEC :: SSECKey -> SSE | Specifies server-side encryption with customer provided key. The argument is the encryption key to be used. |
Presigned Operations
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.
Time to expire for a presigned URL. It interpreted as a number of seconds. The maximum duration that can be specified is 7 days.
POST (browser) upload helpers
Please see https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-HTTPPOSTConstructPolicy.html for detailed information.
newPostPolicy :: UTCTime -> [PostPolicyCondition] -> Either PostPolicyError PostPolicy Source #
This function creates a PostPolicy after validating its arguments.
presignedPostPolicy :: PostPolicy -> Minio (ByteString, HashMap 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).
data PostPolicy Source #
A PostPolicy is required to perform uploads via browser forms.
Instances
ToJSON PostPolicy Source # | |
Defined in Network.Minio.PresignedOperations toJSON :: PostPolicy -> Value # toEncoding :: PostPolicy -> Encoding # toJSONList :: [PostPolicy] -> Value # toEncodingList :: [PostPolicy] -> Encoding # | |
Show PostPolicy Source # | |
Defined in Network.Minio.PresignedOperations showsPrec :: Int -> PostPolicy -> ShowS # show :: PostPolicy -> String # showList :: [PostPolicy] -> ShowS # | |
Eq PostPolicy Source # | |
Defined in Network.Minio.PresignedOperations (==) :: PostPolicy -> PostPolicy -> Bool # (/=) :: PostPolicy -> PostPolicy -> Bool # |
data PostPolicyError Source #
Possible validation errors when creating a PostPolicy.
Instances
Show PostPolicyError Source # | |
Defined in Network.Minio.PresignedOperations showsPrec :: Int -> PostPolicyError -> ShowS # show :: PostPolicyError -> String # showList :: [PostPolicyError] -> ShowS # | |
Eq PostPolicyError Source # | |
Defined in Network.Minio.PresignedOperations (==) :: PostPolicyError -> PostPolicyError -> Bool # (/=) :: PostPolicyError -> PostPolicyError -> Bool # |
Post Policy condition helpers
data PostPolicyCondition Source #
Represents individual conditions in a Post Policy document.
Instances
ToJSON PostPolicyCondition Source # | |
Defined in Network.Minio.PresignedOperations toJSON :: PostPolicyCondition -> Value # toEncoding :: PostPolicyCondition -> Encoding # toJSONList :: [PostPolicyCondition] -> Value # toEncodingList :: [PostPolicyCondition] -> Encoding # | |
Show PostPolicyCondition Source # | |
Defined in Network.Minio.PresignedOperations showsPrec :: Int -> PostPolicyCondition -> ShowS # show :: PostPolicyCondition -> String # showList :: [PostPolicyCondition] -> ShowS # | |
Eq PostPolicyCondition Source # | |
Defined in Network.Minio.PresignedOperations (==) :: PostPolicyCondition -> PostPolicyCondition -> Bool # (/=) :: PostPolicyCondition -> PostPolicyCondition -> Bool # |
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
Instances
Exception MinioErr Source # | |
Defined in Network.Minio.Errors toException :: MinioErr -> SomeException # fromException :: SomeException -> Maybe MinioErr # displayException :: MinioErr -> String # | |
Show MinioErr Source # | |
Eq MinioErr Source # | |
Various validation errors
Instances
Exception MErrV Source # | |
Defined in Network.Minio.Errors toException :: MErrV -> SomeException # fromException :: SomeException -> Maybe MErrV # displayException :: MErrV -> String # | |
Show MErrV Source # | |
Eq MErrV Source # | |
data ServiceErr Source #
Errors returned by S3 compatible service
BucketAlreadyExists | |
BucketAlreadyOwnedByYou | |
NoSuchBucket | |
InvalidBucketName | |
NoSuchKey | |
SelectErr Text Text | |
ServiceErr Text Text |
Instances
Exception ServiceErr Source # | |
Defined in Network.Minio.Errors toException :: ServiceErr -> SomeException # fromException :: SomeException -> Maybe ServiceErr # displayException :: ServiceErr -> String # | |
Show ServiceErr Source # | |
Defined in Network.Minio.Errors showsPrec :: Int -> ServiceErr -> ShowS # show :: ServiceErr -> String # showList :: [ServiceErr] -> ShowS # | |
Eq ServiceErr Source # | |
Defined in Network.Minio.Errors (==) :: ServiceErr -> ServiceErr -> Bool # (/=) :: ServiceErr -> ServiceErr -> Bool # |