aws 0.25.1 → 0.25.2
raw patch · 4 files changed
+119/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Aws.S3.Commands.RestoreObject: RestoreObject :: Object -> Bucket -> Maybe Text -> RestoreObjectTier -> RestoreObjectLifetimeDays -> RestoreObject
+ Aws.S3.Commands.RestoreObject: RestoreObjectAccepted :: RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: RestoreObjectAlreadyInProgress :: RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: RestoreObjectAlreadyRestored :: RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: RestoreObjectLifetimeDays :: Integer -> RestoreObjectLifetimeDays
+ Aws.S3.Commands.RestoreObject: RestoreObjectTierBulk :: RestoreObjectTier
+ Aws.S3.Commands.RestoreObject: RestoreObjectTierExpedited :: RestoreObjectTier
+ Aws.S3.Commands.RestoreObject: RestoreObjectTierStandard :: RestoreObjectTier
+ Aws.S3.Commands.RestoreObject: [roBucket] :: RestoreObject -> Bucket
+ Aws.S3.Commands.RestoreObject: [roObjectLifetimeDays] :: RestoreObject -> RestoreObjectLifetimeDays
+ Aws.S3.Commands.RestoreObject: [roObjectName] :: RestoreObject -> Object
+ Aws.S3.Commands.RestoreObject: [roTier] :: RestoreObject -> RestoreObjectTier
+ Aws.S3.Commands.RestoreObject: [roVersionId] :: RestoreObject -> Maybe Text
+ Aws.S3.Commands.RestoreObject: data RestoreObject
+ Aws.S3.Commands.RestoreObject: data RestoreObjectLifetimeDays
+ Aws.S3.Commands.RestoreObject: data RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: data RestoreObjectTier
+ Aws.S3.Commands.RestoreObject: instance Aws.Core.AsMemoryResponse Aws.S3.Commands.RestoreObject.RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: instance Aws.Core.ResponseConsumer Aws.S3.Commands.RestoreObject.RestoreObject Aws.S3.Commands.RestoreObject.RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: instance Aws.Core.SignQuery Aws.S3.Commands.RestoreObject.RestoreObject
+ Aws.S3.Commands.RestoreObject: instance Aws.Core.Transaction Aws.S3.Commands.RestoreObject.RestoreObject Aws.S3.Commands.RestoreObject.RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: instance GHC.Show.Show Aws.S3.Commands.RestoreObject.RestoreObject
+ Aws.S3.Commands.RestoreObject: instance GHC.Show.Show Aws.S3.Commands.RestoreObject.RestoreObjectLifetimeDays
+ Aws.S3.Commands.RestoreObject: instance GHC.Show.Show Aws.S3.Commands.RestoreObject.RestoreObjectResponse
+ Aws.S3.Commands.RestoreObject: instance GHC.Show.Show Aws.S3.Commands.RestoreObject.RestoreObjectTier
+ Aws.S3.Commands.RestoreObject: restoreObject :: Bucket -> Text -> RestoreObjectTier -> RestoreObjectLifetimeDays -> RestoreObject
Files
- Aws/S3/Commands.hs +2/−0
- Aws/S3/Commands/RestoreObject.hs +112/−0
- CHANGELOG.md +2/−0
- aws.cabal +3/−2
Aws/S3/Commands.hs view
@@ -15,6 +15,7 @@ , module Aws.S3.Commands.PutBucket , module Aws.S3.Commands.PutBucketVersioning , module Aws.S3.Commands.PutObject+, module Aws.S3.Commands.RestoreObject , module Aws.S3.Commands.Multipart ) where@@ -34,4 +35,5 @@ import Aws.S3.Commands.PutBucket import Aws.S3.Commands.PutBucketVersioning import Aws.S3.Commands.PutObject+import Aws.S3.Commands.RestoreObject import Aws.S3.Commands.Multipart
+ Aws/S3/Commands/RestoreObject.hs view
@@ -0,0 +1,112 @@+{-# LANGUAGE CPP #-}+module Aws.S3.Commands.RestoreObject+where++import Aws.Core+import Aws.S3.Core+import qualified Data.ByteString.Lazy.Char8 as B8+import qualified Data.Map as M+import Data.Maybe+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Network.HTTP.Types as HTTP+import qualified Network.HTTP.Conduit as HTTP+import qualified Text.XML as XML+#if !MIN_VERSION_time(1,5,0)+import System.Locale+#endif+import Prelude++data RestoreObject+ = RestoreObject { roObjectName :: Object+ , roBucket :: Bucket+ , roVersionId :: Maybe T.Text+ , roTier :: RestoreObjectTier+ , roObjectLifetimeDays :: RestoreObjectLifetimeDays+ }+ deriving (Show)++data RestoreObjectTier+ = RestoreObjectTierExpedited+ | RestoreObjectTierStandard+ | RestoreObjectTierBulk+ deriving (Show)++data RestoreObjectLifetimeDays = RestoreObjectLifetimeDays Integer+ deriving (Show)++restoreObject :: Bucket -> T.Text -> RestoreObjectTier -> RestoreObjectLifetimeDays -> RestoreObject+restoreObject bucket obj tier lifetime = RestoreObject obj bucket Nothing tier lifetime++data RestoreObjectResponse+ = RestoreObjectAccepted+ | RestoreObjectAlreadyRestored+ | RestoreObjectAlreadyInProgress+ deriving (Show)++-- | ServiceConfiguration: 'S3Configuration'+instance SignQuery RestoreObject where+ type ServiceConfiguration RestoreObject = S3Configuration+ signQuery RestoreObject {..} = s3SignQuery S3Query+ { s3QMethod = Post+ , s3QBucket = Just $ T.encodeUtf8 roBucket+ , s3QObject = Just $ T.encodeUtf8 roObjectName+ , s3QSubresources = HTTP.toQuery+ [ Just ( "restore" :: B8.ByteString, Nothing :: Maybe T.Text)+ , case roVersionId of+ Nothing -> Nothing+ Just v -> Just ("versionId" :: B8.ByteString, Just v)+ ]+ , s3QQuery = []+ , s3QContentType = Nothing+ , s3QContentMd5 = Nothing+ , s3QAmzHeaders = []+ , s3QOtherHeaders = []+ , s3QRequestBody = (Just . HTTP.RequestBodyLBS . XML.renderLBS XML.def)+ XML.Document+ { XML.documentPrologue = XML.Prologue [] Nothing []+ , XML.documentRoot = XML.Element+ { XML.elementName = "{http://s3.amazonaws.com/doc/2006-03-01/}RestoreRequest"+ , XML.elementAttributes = M.empty+ , XML.elementNodes =+ [ XML.NodeElement (XML.Element+ { XML.elementName = "{http://s3.amazonaws.com/doc/2006-03-01/}Days"+ , XML.elementAttributes = M.empty+ , XML.elementNodes = case roObjectLifetimeDays of+ RestoreObjectLifetimeDays n -> [XML.NodeContent (T.pack (show n))]+ })+ , XML.NodeElement (XML.Element+ { XML.elementName = "{http://s3.amazonaws.com/doc/2006-03-01/}GlacierJobParameters"+ , XML.elementAttributes = M.empty+ , XML.elementNodes =+ [ XML.NodeElement (XML.Element+ { XML.elementName = "{http://s3.amazonaws.com/doc/2006-03-01/}Tier"+ , XML.elementAttributes = M.empty+ , XML.elementNodes = case roTier of+ RestoreObjectTierExpedited -> [XML.NodeContent "Expedited"]+ RestoreObjectTierStandard -> [XML.NodeContent "Standard"]+ RestoreObjectTierBulk -> [XML.NodeContent "Bulk"] + })+ ]+ })+ ]+ }+ , XML.documentEpilogue = []+ }+ }++instance ResponseConsumer RestoreObject RestoreObjectResponse where+ type ResponseMetadata RestoreObjectResponse = S3Metadata+ responseConsumer httpReq _ _ resp+ | status == HTTP.status202 = return RestoreObjectAccepted+ | status == HTTP.status200 = return RestoreObjectAlreadyRestored+ | status == HTTP.status409 = return RestoreObjectAlreadyInProgress+ | otherwise = throwStatusCodeException httpReq resp+ where+ status = HTTP.responseStatus resp++instance Transaction RestoreObject RestoreObjectResponse++instance AsMemoryResponse RestoreObjectResponse where+ type MemoryResponse RestoreObjectResponse = RestoreObjectResponse+ loadToMemory = return
CHANGELOG.md view
@@ -5,6 +5,8 @@ most users. I recommend using smart constructors and {} matching syntax whenever possible when interacting with aws types. +- 0.25.2+ - S3: Add RestoreObject command - 0.25.1 - S3: Make getBucket support Google Object Storage, which does not include StorageClass in its response, by defaulting to Standard.
aws.cabal view
@@ -1,5 +1,5 @@ Name: aws-Version: 0.25.1+Version: 0.25.2 Synopsis: Amazon Web Services (AWS) for Haskell Description: Bindings for Amazon Web Services (AWS), with the aim of supporting all AWS services. To see a high level overview of the library, see the README at <https://github.com/aristidb/aws/blob/master/README.md>. Homepage: http://github.com/aristidb/aws@@ -19,7 +19,7 @@ Source-repository this type: git location: https://github.com/aristidb/aws.git- tag: 0.25+ tag: 0.25.2 Source-repository head type: git@@ -93,6 +93,7 @@ Aws.S3.Commands.PutBucket Aws.S3.Commands.PutBucketVersioning Aws.S3.Commands.PutObject+ Aws.S3.Commands.RestoreObject Aws.S3.Commands.Multipart Aws.S3.Core Aws.Ses