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

Safe Haskell | None

Network.AWS.S3Object

Contents

- Function Types
- Data Types

Description

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

Synopsis

- sendObject :: AWSConnection -> S3Object -> IO (AWSResult ())
- copyObject :: AWSConnection -> S3Object -> S3Object -> IO (AWSResult S3Object)
- copyObjectWithReplace :: AWSConnection -> S3Object -> S3Object -> IO (AWSResult S3Object)
- getObject :: AWSConnection -> S3Object -> IO (AWSResult S3Object)
- getObjectInfo :: AWSConnection -> S3Object -> IO (AWSResult S3Object)
- deleteObject :: AWSConnection -> S3Object -> IO (AWSResult ())
- publicUriForSeconds :: AWSConnection -> S3Object -> Integer -> IO URI
- publicUriUntilTime :: AWSConnection -> S3Object -> Integer -> URI
- setStorageClass :: StorageClass -> S3Object -> S3Object
- getStorageClass :: S3Object -> Maybe StorageClass
- rewriteStorageClass :: AWSConnection -> StorageClass -> S3Object -> IO (AWSResult S3Object)
- data S3Object = S3Object {
  - obj_bucket :: String
  - obj_name :: String
  - content_type :: String
  - obj_headers :: [(String, String)]
  - obj_data :: ByteString
  }
- data StorageClass
  - = STANDARD
  - | REDUCED_REDUNDANCY

# Function Types

sendObject Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Object to add to a bucket
-> IO (AWSResult ()) | Server response

Send data for an object. If the header Content-Length is not set, all content must be read into memory prior to sending.

copyObject Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Source object (bucket+name only)
-> S3Object | Destination object
-> IO (AWSResult S3Object) | Server response, headers include version information

Copy object from one bucket to another (or the same bucket), preserving the original headers. Headers from `destobj` are sent, while only the bucket and name of `srcobj` are used. For the best performance, when changing headers during a copy, use the `copyObjectWithReplace` function. For conditional copying, the following headers set on the destination object may be used: `x-amz-copy-source-if-match`, `x-amz-copy-source-if-none-match`, `x-amz-copy-source-if-unmodified-since`, or `x-amz-copy-source-if-modified-since`. See http://docs.amazonwebservices.com/AmazonS3/2006-03-01/API/index.html?RESTObjectCOPY.html for more details.

copyObjectWithReplace Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Source object (bucket+name only)
-> S3Object | Destination object
-> IO (AWSResult S3Object) | Server response, headers include version information

Copy object from one bucket to another (or the same bucket), replacing headers. Any headers from `srcobj` are ignored, and only those set in `destobj` are used.

getObject Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Object to retrieve
-> IO (AWSResult S3Object) | Server response

Retrieve an object.

getObjectInfo Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Object to retrieve information on
-> IO (AWSResult S3Object) | Server response

Get object info without retrieving content body from server.

deleteObject Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Object to delete
-> IO (AWSResult ()) | Server response

Delete an object. Only bucket and object name need to be specified in the S3Object. Deletion of a non-existent object does not return an error.

publicUriForSeconds Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Object to be made available
-> Integer | How many seconds until this request expires
-> IO URI | URI for the object

Create a pre-signed request URI. Anyone can use this to request an object for the number of seconds specified.

publicUriUntilTime Source

Arguments

:: AWSConnection | AWS connection information
-> S3Object | Object to be made available
-> Integer | Expiration time, in seconds since 00:00:00 UTC on January 1, 1970
-> URI | URI for the object

Create a pre-signed request URI. Anyone can use this to request an object until the specified date.

setStorageClass Source

Arguments

:: StorageClass | Storage class to request
-> S3Object | Object to modify
-> S3Object | Object with storage class headers set, ready to be sent

Add required headers for the storage class. Use this in combination with `sendObject` for new objects. To modify the storage class of existing objects, use `rewriteStorageClass`. Using reduced redundancy for object storage trades off redundancy for storage costs.

getStorageClass Source

Arguments

:: S3Object | Object to inspect
-> Maybe StorageClass | Requested storage class, Nothing if unspecified

Retrieve the storage class of a local S3Object. Does not work for objects retrieved with `getObject`, since the required header values are not returned. Use `getObjectStorageClass` or `listObjects` from S3Bucket module to determine storage class of existing objects.

rewriteStorageClass Source

Arguments

:: AWSConnection | AWS connection information
-> StorageClass | New storage class for object
-> S3Object | Object to modify
-> IO (AWSResult S3Object) | Server response

Change the storage class (and only the storage class) of an existing object. This actually performs a copy to the same location, preserving metadata. It is not clear to me whether ACLs are preserved when copying to the same location. For best performance, we must not change other headers during storage class changes.

# Data Types

data S3Object Source

An object that can be stored and retrieved from S3.

Constructors

S3Object |

Fields

obj_bucket :: String

  Name of the bucket containing this object

obj_name :: String

  URI of the object. Subresources (?acl or | ?torrent) should be suffixed onto this name.

content_type :: String

  A standard MIME type describing the format of the contents. If not specified, `binary/octet-stream` is used.

obj_headers :: [(String, String)]

  Object metadata in (key,value) pairs. Key names should use the prefix `x-amz-meta-` to be stored with the object. The total HTTP request must be under 4KB, including these headers.

obj_data :: ByteString

  Object data.

Instances

Read S3Object |
Show S3Object |

data StorageClass Source

Constructors

STANDARD |
REDUCED_REDUNDANCY |

Instances

Eq StorageClass |
Read StorageClass |
Show StorageClass |