hS3-0.5.6: Interface to Amazon's Simple Storage Service (S3)

Network.AWS.S3Bucket

Contents

- Function Types
- Data Types

Description

Bucket interface for Amazon S3 API Version 2006-03-01 http://docs.amazonwebservices.com/AmazonS3/2006-03-01/

Synopsis

- createBucketIn :: AWSConnection -> String -> String -> IO (AWSResult ())
- createBucket :: AWSConnection -> String -> IO (AWSResult ())
- createBucketWithPrefixIn :: AWSConnection -> String -> String -> IO (AWSResult String)
- createBucketWithPrefix :: AWSConnection -> String -> IO (AWSResult String)
- deleteBucket :: AWSConnection -> String -> IO (AWSResult ())
- getBucketLocation :: AWSConnection -> String -> IO (AWSResult String)
- emptyBucket :: AWSConnection -> String -> IO (AWSResult ())
- listBuckets :: AWSConnection -> IO (AWSResult [S3Bucket])
- listObjects :: AWSConnection -> String -> ListRequest -> IO (AWSResult (IsTruncated, [ListResult]))
- listAllObjects :: AWSConnection -> String -> ListRequest -> IO (AWSResult [ListResult])
- isBucketNameValid :: String -> Bool
- getObjectStorageClass :: AWSConnection -> S3Object -> IO (AWSResult StorageClass)
- getVersioningConfiguration :: AWSConnection -> String -> IO (AWSResult VersioningConfiguration)
- setVersioningConfiguration :: AWSConnection -> String -> VersioningConfiguration -> IO (AWSResult ())
- data S3Bucket = S3Bucket {
  - bucket_name :: String
  - bucket_creation_date :: String
  }
- data ListRequest = ListRequest {
  - prefix :: String
  - marker :: String
  - delimiter :: String
  - max_keys :: Int
  }
- data ListResult = ListResult {
  - key :: String
  - last_modified :: String
  - etag :: String
  - size :: Integer
  - storageClass :: StorageClass
  }
- type IsTruncated = Bool
- data VersioningConfiguration = VersioningConfiguration {
  - versioningStatus :: VersioningStatus
  - mfaDeleteEnabled :: Bool
  }
- data VersioningStatus
  - = VersioningDisabled
  - | VersioningEnabled
  - | VersioningSuspended

# Function Types

createBucketIn

Arguments

:: AWSConnection | AWS connection information
-> String | Proposed bucket name
-> String | Location (US, EU, us-west-1, ap-southeast-1)
-> IO (AWSResult ()) | Server response

Create a new bucket on S3 with the given name.

createBucket

Arguments

:: AWSConnection | AWS connection information
-> String | Proposed bucket name
-> IO (AWSResult ()) | Server response

Create a new bucket on S3 with the given name.

createBucketWithPrefixIn

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name prefix
-> String | Location (US, EU, us-west-1, ap-southeast-1)
-> IO (AWSResult String) | Server response, if successful, the bucket name is returned.

Create a new bucket on S3 with the given prefix, and a random suffix. This can be used to programatically create buckets without of naming conflicts.

createBucketWithPrefix

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name prefix
-> IO (AWSResult String) | Server response, with bucket name

see createBucketWithPrefixIn, but hardcoded for the US

deleteBucket

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name to delete
-> IO (AWSResult ()) | Server response

Delete a bucket with the given name on S3. The bucket must be empty for deletion to succeed.

getBucketLocation

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name
-> IO (AWSResult String) | Server response (US, EU, us-west-1, ap-southeast-1, etc.)

Physical location of the bucket. US or EU

emptyBucket

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name to empty
-> IO (AWSResult ()) | Server response

Empty a bucket of all objects. Iterates through all objects issuing delete commands, so time is proportional to number of objects in the bucket. At this time, delete requests are free from Amazon.

listBuckets

Arguments

:: AWSConnection | AWS connection information
-> IO (AWSResult [S3Bucket]) | Server response

Return a list of all bucket names and creation dates. S3 allows a maximum of 100 buckets per user.

listObjects

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name to search
-> ListRequest | List parameters
-> IO (AWSResult (IsTruncated, [ListResult])) | Server response

List objects in a bucket, based on parameters from `ListRequest`. See the Amazon S3 developer resources for in depth explanation of how the fields in `ListRequest` can be used to query for objects. http://docs.amazonwebservices.com/AmazonS3/2006-03-01/ListingKeysRequest.html

listAllObjects

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name to search
-> ListRequest | List parameters
-> IO (AWSResult [ListResult]) | Server response

Repeatedly query the server for all objects in a bucket, ignoring the `max_keys` field.

isBucketNameValid :: String -> Bool

Check Amazon guidelines on bucket naming. (missing test for IP-like names)

getObjectStorageClass :: AWSConnection -> S3Object -> IO (AWSResult StorageClass)

Retrieve the storage class of an object from S3. For checking more than one object's storage class efficiently, use listObjects.

getVersioningConfiguration

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket name to inquire on
-> IO (AWSResult VersioningConfiguration) | Server response

Check versioning and MFA configuration of a bucket.

setVersioningConfiguration

Arguments

:: AWSConnection | AWS connection information
-> String | Bucket to modify
-> VersioningConfiguration | Desired versioning configuration
-> IO (AWSResult ()) | Server response

Set the versioning configuration of a bucket (MFA not yet supported).

# Data Types

data S3Bucket

Constructors

S3Bucket |

Fields

bucket_name :: String
bucket_creation_date :: String

Instances

Eq S3Bucket |
Show S3Bucket |

data ListRequest

List request parameters

Constructors

ListRequest |

Fields

prefix :: String
marker :: String
delimiter :: String
max_keys :: Int

Instances

Show ListRequest |

data ListResult

Result from listing objects.

Constructors

ListResult |

Fields

key :: String

  Name of object

last_modified :: String

  Last modification date

etag :: String

  MD5

size :: Integer

  Bytes of object data

storageClass :: StorageClass

  Storage class of the object

Instances

Show ListResult |

type IsTruncated = Bool

Is a result set response truncated?

data VersioningConfiguration

Constructors

VersioningConfiguration |

Fields

versioningStatus :: VersioningStatus
mfaDeleteEnabled :: Bool

Instances

Eq VersioningConfiguration |
Read VersioningConfiguration |
Show VersioningConfiguration |

data VersioningStatus

Constructors

VersioningDisabled |
VersioningEnabled |
VersioningSuspended |

Instances

Eq VersioningStatus |
Read VersioningStatus |
Show VersioningStatus |