{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.S3.GetObjectTorrent
(
GetObjectTorrent (..),
newGetObjectTorrent,
getObjectTorrent_requestPayer,
getObjectTorrent_expectedBucketOwner,
getObjectTorrent_bucket,
getObjectTorrent_key,
GetObjectTorrentResponse (..),
newGetObjectTorrentResponse,
getObjectTorrentResponse_requestCharged,
getObjectTorrentResponse_httpStatus,
getObjectTorrentResponse_body,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types
data GetObjectTorrent = GetObjectTorrent'
{ GetObjectTorrent -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
GetObjectTorrent -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetObjectTorrent -> BucketName
bucket :: BucketName,
GetObjectTorrent -> ObjectKey
key :: ObjectKey
}
deriving (GetObjectTorrent -> GetObjectTorrent -> Bool
(GetObjectTorrent -> GetObjectTorrent -> Bool)
-> (GetObjectTorrent -> GetObjectTorrent -> Bool)
-> Eq GetObjectTorrent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectTorrent -> GetObjectTorrent -> Bool
$c/= :: GetObjectTorrent -> GetObjectTorrent -> Bool
== :: GetObjectTorrent -> GetObjectTorrent -> Bool
$c== :: GetObjectTorrent -> GetObjectTorrent -> Bool
Prelude.Eq, ReadPrec [GetObjectTorrent]
ReadPrec GetObjectTorrent
Int -> ReadS GetObjectTorrent
ReadS [GetObjectTorrent]
(Int -> ReadS GetObjectTorrent)
-> ReadS [GetObjectTorrent]
-> ReadPrec GetObjectTorrent
-> ReadPrec [GetObjectTorrent]
-> Read GetObjectTorrent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectTorrent]
$creadListPrec :: ReadPrec [GetObjectTorrent]
readPrec :: ReadPrec GetObjectTorrent
$creadPrec :: ReadPrec GetObjectTorrent
readList :: ReadS [GetObjectTorrent]
$creadList :: ReadS [GetObjectTorrent]
readsPrec :: Int -> ReadS GetObjectTorrent
$creadsPrec :: Int -> ReadS GetObjectTorrent
Prelude.Read, Int -> GetObjectTorrent -> ShowS
[GetObjectTorrent] -> ShowS
GetObjectTorrent -> String
(Int -> GetObjectTorrent -> ShowS)
-> (GetObjectTorrent -> String)
-> ([GetObjectTorrent] -> ShowS)
-> Show GetObjectTorrent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectTorrent] -> ShowS
$cshowList :: [GetObjectTorrent] -> ShowS
show :: GetObjectTorrent -> String
$cshow :: GetObjectTorrent -> String
showsPrec :: Int -> GetObjectTorrent -> ShowS
$cshowsPrec :: Int -> GetObjectTorrent -> ShowS
Prelude.Show, (forall x. GetObjectTorrent -> Rep GetObjectTorrent x)
-> (forall x. Rep GetObjectTorrent x -> GetObjectTorrent)
-> Generic GetObjectTorrent
forall x. Rep GetObjectTorrent x -> GetObjectTorrent
forall x. GetObjectTorrent -> Rep GetObjectTorrent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetObjectTorrent x -> GetObjectTorrent
$cfrom :: forall x. GetObjectTorrent -> Rep GetObjectTorrent x
Prelude.Generic)
newGetObjectTorrent ::
BucketName ->
ObjectKey ->
GetObjectTorrent
newGetObjectTorrent :: BucketName -> ObjectKey -> GetObjectTorrent
newGetObjectTorrent BucketName
pBucket_ ObjectKey
pKey_ =
GetObjectTorrent' :: Maybe RequestPayer
-> Maybe Text -> BucketName -> ObjectKey -> GetObjectTorrent
GetObjectTorrent'
{ $sel:requestPayer:GetObjectTorrent' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
forall a. Maybe a
Prelude.Nothing,
$sel:expectedBucketOwner:GetObjectTorrent' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetObjectTorrent' :: BucketName
bucket = BucketName
pBucket_,
$sel:key:GetObjectTorrent' :: ObjectKey
key = ObjectKey
pKey_
}
getObjectTorrent_requestPayer :: Lens.Lens' GetObjectTorrent (Prelude.Maybe RequestPayer)
getObjectTorrent_requestPayer :: (Maybe RequestPayer -> f (Maybe RequestPayer))
-> GetObjectTorrent -> f GetObjectTorrent
getObjectTorrent_requestPayer = (GetObjectTorrent -> Maybe RequestPayer)
-> (GetObjectTorrent -> Maybe RequestPayer -> GetObjectTorrent)
-> Lens
GetObjectTorrent
GetObjectTorrent
(Maybe RequestPayer)
(Maybe RequestPayer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTorrent' {Maybe RequestPayer
requestPayer :: Maybe RequestPayer
$sel:requestPayer:GetObjectTorrent' :: GetObjectTorrent -> Maybe RequestPayer
requestPayer} -> Maybe RequestPayer
requestPayer) (\s :: GetObjectTorrent
s@GetObjectTorrent' {} Maybe RequestPayer
a -> GetObjectTorrent
s {$sel:requestPayer:GetObjectTorrent' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
a} :: GetObjectTorrent)
getObjectTorrent_expectedBucketOwner :: Lens.Lens' GetObjectTorrent (Prelude.Maybe Prelude.Text)
getObjectTorrent_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetObjectTorrent -> f GetObjectTorrent
getObjectTorrent_expectedBucketOwner = (GetObjectTorrent -> Maybe Text)
-> (GetObjectTorrent -> Maybe Text -> GetObjectTorrent)
-> Lens GetObjectTorrent GetObjectTorrent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTorrent' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetObjectTorrent' :: GetObjectTorrent -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetObjectTorrent
s@GetObjectTorrent' {} Maybe Text
a -> GetObjectTorrent
s {$sel:expectedBucketOwner:GetObjectTorrent' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetObjectTorrent)
getObjectTorrent_bucket :: Lens.Lens' GetObjectTorrent BucketName
getObjectTorrent_bucket :: (BucketName -> f BucketName)
-> GetObjectTorrent -> f GetObjectTorrent
getObjectTorrent_bucket = (GetObjectTorrent -> BucketName)
-> (GetObjectTorrent -> BucketName -> GetObjectTorrent)
-> Lens GetObjectTorrent GetObjectTorrent BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTorrent' {BucketName
bucket :: BucketName
$sel:bucket:GetObjectTorrent' :: GetObjectTorrent -> BucketName
bucket} -> BucketName
bucket) (\s :: GetObjectTorrent
s@GetObjectTorrent' {} BucketName
a -> GetObjectTorrent
s {$sel:bucket:GetObjectTorrent' :: BucketName
bucket = BucketName
a} :: GetObjectTorrent)
getObjectTorrent_key :: Lens.Lens' GetObjectTorrent ObjectKey
getObjectTorrent_key :: (ObjectKey -> f ObjectKey)
-> GetObjectTorrent -> f GetObjectTorrent
getObjectTorrent_key = (GetObjectTorrent -> ObjectKey)
-> (GetObjectTorrent -> ObjectKey -> GetObjectTorrent)
-> Lens GetObjectTorrent GetObjectTorrent ObjectKey ObjectKey
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTorrent' {ObjectKey
key :: ObjectKey
$sel:key:GetObjectTorrent' :: GetObjectTorrent -> ObjectKey
key} -> ObjectKey
key) (\s :: GetObjectTorrent
s@GetObjectTorrent' {} ObjectKey
a -> GetObjectTorrent
s {$sel:key:GetObjectTorrent' :: ObjectKey
key = ObjectKey
a} :: GetObjectTorrent)
instance Core.AWSRequest GetObjectTorrent where
type
AWSResponse GetObjectTorrent =
GetObjectTorrentResponse
request :: GetObjectTorrent -> Request GetObjectTorrent
request =
Request GetObjectTorrent -> Request GetObjectTorrent
forall a. Request a -> Request a
Request.s3vhost
(Request GetObjectTorrent -> Request GetObjectTorrent)
-> (GetObjectTorrent -> Request GetObjectTorrent)
-> GetObjectTorrent
-> Request GetObjectTorrent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> GetObjectTorrent -> Request GetObjectTorrent
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetObjectTorrent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetObjectTorrent)))
response =
(Int
-> ResponseHeaders
-> ResponseBody
-> Either String (AWSResponse GetObjectTorrent))
-> Logger
-> Service
-> Proxy GetObjectTorrent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetObjectTorrent)))
forall (m :: * -> *) a.
MonadResource m =>
(Int
-> ResponseHeaders
-> ResponseBody
-> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveBody
( \Int
s ResponseHeaders
h ResponseBody
x ->
Maybe RequestCharged
-> Int -> ResponseBody -> GetObjectTorrentResponse
GetObjectTorrentResponse'
(Maybe RequestCharged
-> Int -> ResponseBody -> GetObjectTorrentResponse)
-> Either String (Maybe RequestCharged)
-> Either String (Int -> ResponseBody -> GetObjectTorrentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders
-> HeaderName -> Either String (Maybe RequestCharged)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-request-charged")
Either String (Int -> ResponseBody -> GetObjectTorrentResponse)
-> Either String Int
-> Either String (ResponseBody -> GetObjectTorrentResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (ResponseBody -> GetObjectTorrentResponse)
-> Either String ResponseBody
-> Either String GetObjectTorrentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseBody -> Either String ResponseBody
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure ResponseBody
x)
)
instance Prelude.Hashable GetObjectTorrent
instance Prelude.NFData GetObjectTorrent
instance Core.ToHeaders GetObjectTorrent where
toHeaders :: GetObjectTorrent -> ResponseHeaders
toHeaders GetObjectTorrent' {Maybe Text
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
requestPayer :: Maybe RequestPayer
$sel:key:GetObjectTorrent' :: GetObjectTorrent -> ObjectKey
$sel:bucket:GetObjectTorrent' :: GetObjectTorrent -> BucketName
$sel:expectedBucketOwner:GetObjectTorrent' :: GetObjectTorrent -> Maybe Text
$sel:requestPayer:GetObjectTorrent' :: GetObjectTorrent -> Maybe RequestPayer
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-request-payer" HeaderName -> Maybe RequestPayer -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe RequestPayer
requestPayer,
HeaderName
"x-amz-expected-bucket-owner"
HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
expectedBucketOwner
]
instance Core.ToPath GetObjectTorrent where
toPath :: GetObjectTorrent -> ByteString
toPath GetObjectTorrent' {Maybe Text
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
requestPayer :: Maybe RequestPayer
$sel:key:GetObjectTorrent' :: GetObjectTorrent -> ObjectKey
$sel:bucket:GetObjectTorrent' :: GetObjectTorrent -> BucketName
$sel:expectedBucketOwner:GetObjectTorrent' :: GetObjectTorrent -> Maybe Text
$sel:requestPayer:GetObjectTorrent' :: GetObjectTorrent -> Maybe RequestPayer
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket, ByteString
"/", ObjectKey -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ObjectKey
key]
instance Core.ToQuery GetObjectTorrent where
toQuery :: GetObjectTorrent -> QueryString
toQuery = QueryString -> GetObjectTorrent -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"torrent"])
data GetObjectTorrentResponse = GetObjectTorrentResponse'
{ GetObjectTorrentResponse -> Maybe RequestCharged
requestCharged :: Prelude.Maybe RequestCharged,
GetObjectTorrentResponse -> Int
httpStatus :: Prelude.Int,
GetObjectTorrentResponse -> ResponseBody
body :: Core.ResponseBody
}
deriving (Int -> GetObjectTorrentResponse -> ShowS
[GetObjectTorrentResponse] -> ShowS
GetObjectTorrentResponse -> String
(Int -> GetObjectTorrentResponse -> ShowS)
-> (GetObjectTorrentResponse -> String)
-> ([GetObjectTorrentResponse] -> ShowS)
-> Show GetObjectTorrentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectTorrentResponse] -> ShowS
$cshowList :: [GetObjectTorrentResponse] -> ShowS
show :: GetObjectTorrentResponse -> String
$cshow :: GetObjectTorrentResponse -> String
showsPrec :: Int -> GetObjectTorrentResponse -> ShowS
$cshowsPrec :: Int -> GetObjectTorrentResponse -> ShowS
Prelude.Show, (forall x.
GetObjectTorrentResponse -> Rep GetObjectTorrentResponse x)
-> (forall x.
Rep GetObjectTorrentResponse x -> GetObjectTorrentResponse)
-> Generic GetObjectTorrentResponse
forall x.
Rep GetObjectTorrentResponse x -> GetObjectTorrentResponse
forall x.
GetObjectTorrentResponse -> Rep GetObjectTorrentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetObjectTorrentResponse x -> GetObjectTorrentResponse
$cfrom :: forall x.
GetObjectTorrentResponse -> Rep GetObjectTorrentResponse x
Prelude.Generic)
newGetObjectTorrentResponse ::
Prelude.Int ->
Core.ResponseBody ->
GetObjectTorrentResponse
newGetObjectTorrentResponse :: Int -> ResponseBody -> GetObjectTorrentResponse
newGetObjectTorrentResponse Int
pHttpStatus_ ResponseBody
pBody_ =
GetObjectTorrentResponse' :: Maybe RequestCharged
-> Int -> ResponseBody -> GetObjectTorrentResponse
GetObjectTorrentResponse'
{ $sel:requestCharged:GetObjectTorrentResponse' :: Maybe RequestCharged
requestCharged =
Maybe RequestCharged
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetObjectTorrentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:body:GetObjectTorrentResponse' :: ResponseBody
body = ResponseBody
pBody_
}
getObjectTorrentResponse_requestCharged :: Lens.Lens' GetObjectTorrentResponse (Prelude.Maybe RequestCharged)
getObjectTorrentResponse_requestCharged :: (Maybe RequestCharged -> f (Maybe RequestCharged))
-> GetObjectTorrentResponse -> f GetObjectTorrentResponse
getObjectTorrentResponse_requestCharged = (GetObjectTorrentResponse -> Maybe RequestCharged)
-> (GetObjectTorrentResponse
-> Maybe RequestCharged -> GetObjectTorrentResponse)
-> Lens
GetObjectTorrentResponse
GetObjectTorrentResponse
(Maybe RequestCharged)
(Maybe RequestCharged)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTorrentResponse' {Maybe RequestCharged
requestCharged :: Maybe RequestCharged
$sel:requestCharged:GetObjectTorrentResponse' :: GetObjectTorrentResponse -> Maybe RequestCharged
requestCharged} -> Maybe RequestCharged
requestCharged) (\s :: GetObjectTorrentResponse
s@GetObjectTorrentResponse' {} Maybe RequestCharged
a -> GetObjectTorrentResponse
s {$sel:requestCharged:GetObjectTorrentResponse' :: Maybe RequestCharged
requestCharged = Maybe RequestCharged
a} :: GetObjectTorrentResponse)
getObjectTorrentResponse_httpStatus :: Lens.Lens' GetObjectTorrentResponse Prelude.Int
getObjectTorrentResponse_httpStatus :: (Int -> f Int)
-> GetObjectTorrentResponse -> f GetObjectTorrentResponse
getObjectTorrentResponse_httpStatus = (GetObjectTorrentResponse -> Int)
-> (GetObjectTorrentResponse -> Int -> GetObjectTorrentResponse)
-> Lens GetObjectTorrentResponse GetObjectTorrentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTorrentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetObjectTorrentResponse' :: GetObjectTorrentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetObjectTorrentResponse
s@GetObjectTorrentResponse' {} Int
a -> GetObjectTorrentResponse
s {$sel:httpStatus:GetObjectTorrentResponse' :: Int
httpStatus = Int
a} :: GetObjectTorrentResponse)
getObjectTorrentResponse_body :: Lens.Lens' GetObjectTorrentResponse Core.ResponseBody
getObjectTorrentResponse_body :: (ResponseBody -> f ResponseBody)
-> GetObjectTorrentResponse -> f GetObjectTorrentResponse
getObjectTorrentResponse_body = (GetObjectTorrentResponse -> ResponseBody)
-> (GetObjectTorrentResponse
-> ResponseBody -> GetObjectTorrentResponse)
-> Lens
GetObjectTorrentResponse
GetObjectTorrentResponse
ResponseBody
ResponseBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTorrentResponse' {ResponseBody
body :: ResponseBody
$sel:body:GetObjectTorrentResponse' :: GetObjectTorrentResponse -> ResponseBody
body} -> ResponseBody
body) (\s :: GetObjectTorrentResponse
s@GetObjectTorrentResponse' {} ResponseBody
a -> GetObjectTorrentResponse
s {$sel:body:GetObjectTorrentResponse' :: ResponseBody
body = ResponseBody
a} :: GetObjectTorrentResponse)