{-# 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.Support.DescribeAttachment
(
DescribeAttachment (..),
newDescribeAttachment,
describeAttachment_attachmentId,
DescribeAttachmentResponse (..),
newDescribeAttachmentResponse,
describeAttachmentResponse_attachment,
describeAttachmentResponse_httpStatus,
)
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.Support.Types
data DescribeAttachment = DescribeAttachment'
{
DescribeAttachment -> Text
attachmentId :: Prelude.Text
}
deriving (DescribeAttachment -> DescribeAttachment -> Bool
(DescribeAttachment -> DescribeAttachment -> Bool)
-> (DescribeAttachment -> DescribeAttachment -> Bool)
-> Eq DescribeAttachment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAttachment -> DescribeAttachment -> Bool
$c/= :: DescribeAttachment -> DescribeAttachment -> Bool
== :: DescribeAttachment -> DescribeAttachment -> Bool
$c== :: DescribeAttachment -> DescribeAttachment -> Bool
Prelude.Eq, ReadPrec [DescribeAttachment]
ReadPrec DescribeAttachment
Int -> ReadS DescribeAttachment
ReadS [DescribeAttachment]
(Int -> ReadS DescribeAttachment)
-> ReadS [DescribeAttachment]
-> ReadPrec DescribeAttachment
-> ReadPrec [DescribeAttachment]
-> Read DescribeAttachment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAttachment]
$creadListPrec :: ReadPrec [DescribeAttachment]
readPrec :: ReadPrec DescribeAttachment
$creadPrec :: ReadPrec DescribeAttachment
readList :: ReadS [DescribeAttachment]
$creadList :: ReadS [DescribeAttachment]
readsPrec :: Int -> ReadS DescribeAttachment
$creadsPrec :: Int -> ReadS DescribeAttachment
Prelude.Read, Int -> DescribeAttachment -> ShowS
[DescribeAttachment] -> ShowS
DescribeAttachment -> String
(Int -> DescribeAttachment -> ShowS)
-> (DescribeAttachment -> String)
-> ([DescribeAttachment] -> ShowS)
-> Show DescribeAttachment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAttachment] -> ShowS
$cshowList :: [DescribeAttachment] -> ShowS
show :: DescribeAttachment -> String
$cshow :: DescribeAttachment -> String
showsPrec :: Int -> DescribeAttachment -> ShowS
$cshowsPrec :: Int -> DescribeAttachment -> ShowS
Prelude.Show, (forall x. DescribeAttachment -> Rep DescribeAttachment x)
-> (forall x. Rep DescribeAttachment x -> DescribeAttachment)
-> Generic DescribeAttachment
forall x. Rep DescribeAttachment x -> DescribeAttachment
forall x. DescribeAttachment -> Rep DescribeAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAttachment x -> DescribeAttachment
$cfrom :: forall x. DescribeAttachment -> Rep DescribeAttachment x
Prelude.Generic)
newDescribeAttachment ::
Prelude.Text ->
DescribeAttachment
newDescribeAttachment :: Text -> DescribeAttachment
newDescribeAttachment Text
pAttachmentId_ =
DescribeAttachment' :: Text -> DescribeAttachment
DescribeAttachment' {$sel:attachmentId:DescribeAttachment' :: Text
attachmentId = Text
pAttachmentId_}
describeAttachment_attachmentId :: Lens.Lens' DescribeAttachment Prelude.Text
describeAttachment_attachmentId :: (Text -> f Text) -> DescribeAttachment -> f DescribeAttachment
describeAttachment_attachmentId = (DescribeAttachment -> Text)
-> (DescribeAttachment -> Text -> DescribeAttachment)
-> Lens DescribeAttachment DescribeAttachment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAttachment' {Text
attachmentId :: Text
$sel:attachmentId:DescribeAttachment' :: DescribeAttachment -> Text
attachmentId} -> Text
attachmentId) (\s :: DescribeAttachment
s@DescribeAttachment' {} Text
a -> DescribeAttachment
s {$sel:attachmentId:DescribeAttachment' :: Text
attachmentId = Text
a} :: DescribeAttachment)
instance Core.AWSRequest DescribeAttachment where
type
AWSResponse DescribeAttachment =
DescribeAttachmentResponse
request :: DescribeAttachment -> Request DescribeAttachment
request = Service -> DescribeAttachment -> Request DescribeAttachment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeAttachment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeAttachment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeAttachment))
-> Logger
-> Service
-> Proxy DescribeAttachment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeAttachment)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Attachment -> Int -> DescribeAttachmentResponse
DescribeAttachmentResponse'
(Maybe Attachment -> Int -> DescribeAttachmentResponse)
-> Either String (Maybe Attachment)
-> Either String (Int -> DescribeAttachmentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Attachment)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"attachment")
Either String (Int -> DescribeAttachmentResponse)
-> Either String Int -> Either String DescribeAttachmentResponse
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))
)
instance Prelude.Hashable DescribeAttachment
instance Prelude.NFData DescribeAttachment
instance Core.ToHeaders DescribeAttachment where
toHeaders :: DescribeAttachment -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeAttachment -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSSupport_20130415.DescribeAttachment" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DescribeAttachment where
toJSON :: DescribeAttachment -> Value
toJSON DescribeAttachment' {Text
attachmentId :: Text
$sel:attachmentId:DescribeAttachment' :: DescribeAttachment -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"attachmentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
attachmentId)]
)
instance Core.ToPath DescribeAttachment where
toPath :: DescribeAttachment -> ByteString
toPath = ByteString -> DescribeAttachment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeAttachment where
toQuery :: DescribeAttachment -> QueryString
toQuery = QueryString -> DescribeAttachment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeAttachmentResponse = DescribeAttachmentResponse'
{
DescribeAttachmentResponse -> Maybe Attachment
attachment :: Prelude.Maybe Attachment,
DescribeAttachmentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeAttachmentResponse -> DescribeAttachmentResponse -> Bool
(DescribeAttachmentResponse -> DescribeAttachmentResponse -> Bool)
-> (DescribeAttachmentResponse
-> DescribeAttachmentResponse -> Bool)
-> Eq DescribeAttachmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAttachmentResponse -> DescribeAttachmentResponse -> Bool
$c/= :: DescribeAttachmentResponse -> DescribeAttachmentResponse -> Bool
== :: DescribeAttachmentResponse -> DescribeAttachmentResponse -> Bool
$c== :: DescribeAttachmentResponse -> DescribeAttachmentResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAttachmentResponse]
ReadPrec DescribeAttachmentResponse
Int -> ReadS DescribeAttachmentResponse
ReadS [DescribeAttachmentResponse]
(Int -> ReadS DescribeAttachmentResponse)
-> ReadS [DescribeAttachmentResponse]
-> ReadPrec DescribeAttachmentResponse
-> ReadPrec [DescribeAttachmentResponse]
-> Read DescribeAttachmentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAttachmentResponse]
$creadListPrec :: ReadPrec [DescribeAttachmentResponse]
readPrec :: ReadPrec DescribeAttachmentResponse
$creadPrec :: ReadPrec DescribeAttachmentResponse
readList :: ReadS [DescribeAttachmentResponse]
$creadList :: ReadS [DescribeAttachmentResponse]
readsPrec :: Int -> ReadS DescribeAttachmentResponse
$creadsPrec :: Int -> ReadS DescribeAttachmentResponse
Prelude.Read, Int -> DescribeAttachmentResponse -> ShowS
[DescribeAttachmentResponse] -> ShowS
DescribeAttachmentResponse -> String
(Int -> DescribeAttachmentResponse -> ShowS)
-> (DescribeAttachmentResponse -> String)
-> ([DescribeAttachmentResponse] -> ShowS)
-> Show DescribeAttachmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAttachmentResponse] -> ShowS
$cshowList :: [DescribeAttachmentResponse] -> ShowS
show :: DescribeAttachmentResponse -> String
$cshow :: DescribeAttachmentResponse -> String
showsPrec :: Int -> DescribeAttachmentResponse -> ShowS
$cshowsPrec :: Int -> DescribeAttachmentResponse -> ShowS
Prelude.Show, (forall x.
DescribeAttachmentResponse -> Rep DescribeAttachmentResponse x)
-> (forall x.
Rep DescribeAttachmentResponse x -> DescribeAttachmentResponse)
-> Generic DescribeAttachmentResponse
forall x.
Rep DescribeAttachmentResponse x -> DescribeAttachmentResponse
forall x.
DescribeAttachmentResponse -> Rep DescribeAttachmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAttachmentResponse x -> DescribeAttachmentResponse
$cfrom :: forall x.
DescribeAttachmentResponse -> Rep DescribeAttachmentResponse x
Prelude.Generic)
newDescribeAttachmentResponse ::
Prelude.Int ->
DescribeAttachmentResponse
newDescribeAttachmentResponse :: Int -> DescribeAttachmentResponse
newDescribeAttachmentResponse Int
pHttpStatus_ =
DescribeAttachmentResponse' :: Maybe Attachment -> Int -> DescribeAttachmentResponse
DescribeAttachmentResponse'
{ $sel:attachment:DescribeAttachmentResponse' :: Maybe Attachment
attachment =
Maybe Attachment
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeAttachmentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeAttachmentResponse_attachment :: Lens.Lens' DescribeAttachmentResponse (Prelude.Maybe Attachment)
describeAttachmentResponse_attachment :: (Maybe Attachment -> f (Maybe Attachment))
-> DescribeAttachmentResponse -> f DescribeAttachmentResponse
describeAttachmentResponse_attachment = (DescribeAttachmentResponse -> Maybe Attachment)
-> (DescribeAttachmentResponse
-> Maybe Attachment -> DescribeAttachmentResponse)
-> Lens
DescribeAttachmentResponse
DescribeAttachmentResponse
(Maybe Attachment)
(Maybe Attachment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAttachmentResponse' {Maybe Attachment
attachment :: Maybe Attachment
$sel:attachment:DescribeAttachmentResponse' :: DescribeAttachmentResponse -> Maybe Attachment
attachment} -> Maybe Attachment
attachment) (\s :: DescribeAttachmentResponse
s@DescribeAttachmentResponse' {} Maybe Attachment
a -> DescribeAttachmentResponse
s {$sel:attachment:DescribeAttachmentResponse' :: Maybe Attachment
attachment = Maybe Attachment
a} :: DescribeAttachmentResponse)
describeAttachmentResponse_httpStatus :: Lens.Lens' DescribeAttachmentResponse Prelude.Int
describeAttachmentResponse_httpStatus :: (Int -> f Int)
-> DescribeAttachmentResponse -> f DescribeAttachmentResponse
describeAttachmentResponse_httpStatus = (DescribeAttachmentResponse -> Int)
-> (DescribeAttachmentResponse
-> Int -> DescribeAttachmentResponse)
-> Lens
DescribeAttachmentResponse DescribeAttachmentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAttachmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeAttachmentResponse' :: DescribeAttachmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeAttachmentResponse
s@DescribeAttachmentResponse' {} Int
a -> DescribeAttachmentResponse
s {$sel:httpStatus:DescribeAttachmentResponse' :: Int
httpStatus = Int
a} :: DescribeAttachmentResponse)
instance Prelude.NFData DescribeAttachmentResponse