{-# 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.ConnectParticipant.GetAttachment
(
GetAttachment (..),
newGetAttachment,
getAttachment_attachmentId,
getAttachment_connectionToken,
GetAttachmentResponse (..),
newGetAttachmentResponse,
getAttachmentResponse_urlExpiry,
getAttachmentResponse_url,
getAttachmentResponse_httpStatus,
)
where
import Amazonka.ConnectParticipant.Types
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
data GetAttachment = GetAttachment'
{
GetAttachment -> Text
attachmentId :: Prelude.Text,
GetAttachment -> Text
connectionToken :: Prelude.Text
}
deriving (GetAttachment -> GetAttachment -> Bool
(GetAttachment -> GetAttachment -> Bool)
-> (GetAttachment -> GetAttachment -> Bool) -> Eq GetAttachment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttachment -> GetAttachment -> Bool
$c/= :: GetAttachment -> GetAttachment -> Bool
== :: GetAttachment -> GetAttachment -> Bool
$c== :: GetAttachment -> GetAttachment -> Bool
Prelude.Eq, ReadPrec [GetAttachment]
ReadPrec GetAttachment
Int -> ReadS GetAttachment
ReadS [GetAttachment]
(Int -> ReadS GetAttachment)
-> ReadS [GetAttachment]
-> ReadPrec GetAttachment
-> ReadPrec [GetAttachment]
-> Read GetAttachment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAttachment]
$creadListPrec :: ReadPrec [GetAttachment]
readPrec :: ReadPrec GetAttachment
$creadPrec :: ReadPrec GetAttachment
readList :: ReadS [GetAttachment]
$creadList :: ReadS [GetAttachment]
readsPrec :: Int -> ReadS GetAttachment
$creadsPrec :: Int -> ReadS GetAttachment
Prelude.Read, Int -> GetAttachment -> ShowS
[GetAttachment] -> ShowS
GetAttachment -> String
(Int -> GetAttachment -> ShowS)
-> (GetAttachment -> String)
-> ([GetAttachment] -> ShowS)
-> Show GetAttachment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAttachment] -> ShowS
$cshowList :: [GetAttachment] -> ShowS
show :: GetAttachment -> String
$cshow :: GetAttachment -> String
showsPrec :: Int -> GetAttachment -> ShowS
$cshowsPrec :: Int -> GetAttachment -> ShowS
Prelude.Show, (forall x. GetAttachment -> Rep GetAttachment x)
-> (forall x. Rep GetAttachment x -> GetAttachment)
-> Generic GetAttachment
forall x. Rep GetAttachment x -> GetAttachment
forall x. GetAttachment -> Rep GetAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAttachment x -> GetAttachment
$cfrom :: forall x. GetAttachment -> Rep GetAttachment x
Prelude.Generic)
newGetAttachment ::
Prelude.Text ->
Prelude.Text ->
GetAttachment
newGetAttachment :: Text -> Text -> GetAttachment
newGetAttachment Text
pAttachmentId_ Text
pConnectionToken_ =
GetAttachment' :: Text -> Text -> GetAttachment
GetAttachment'
{ $sel:attachmentId:GetAttachment' :: Text
attachmentId = Text
pAttachmentId_,
$sel:connectionToken:GetAttachment' :: Text
connectionToken = Text
pConnectionToken_
}
getAttachment_attachmentId :: Lens.Lens' GetAttachment Prelude.Text
getAttachment_attachmentId :: (Text -> f Text) -> GetAttachment -> f GetAttachment
getAttachment_attachmentId = (GetAttachment -> Text)
-> (GetAttachment -> Text -> GetAttachment)
-> Lens GetAttachment GetAttachment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttachment' {Text
attachmentId :: Text
$sel:attachmentId:GetAttachment' :: GetAttachment -> Text
attachmentId} -> Text
attachmentId) (\s :: GetAttachment
s@GetAttachment' {} Text
a -> GetAttachment
s {$sel:attachmentId:GetAttachment' :: Text
attachmentId = Text
a} :: GetAttachment)
getAttachment_connectionToken :: Lens.Lens' GetAttachment Prelude.Text
getAttachment_connectionToken :: (Text -> f Text) -> GetAttachment -> f GetAttachment
getAttachment_connectionToken = (GetAttachment -> Text)
-> (GetAttachment -> Text -> GetAttachment)
-> Lens GetAttachment GetAttachment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttachment' {Text
connectionToken :: Text
$sel:connectionToken:GetAttachment' :: GetAttachment -> Text
connectionToken} -> Text
connectionToken) (\s :: GetAttachment
s@GetAttachment' {} Text
a -> GetAttachment
s {$sel:connectionToken:GetAttachment' :: Text
connectionToken = Text
a} :: GetAttachment)
instance Core.AWSRequest GetAttachment where
type
AWSResponse GetAttachment =
GetAttachmentResponse
request :: GetAttachment -> Request GetAttachment
request = Service -> GetAttachment -> Request GetAttachment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetAttachment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAttachment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAttachment))
-> Logger
-> Service
-> Proxy GetAttachment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAttachment)))
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 Text -> Maybe Text -> Int -> GetAttachmentResponse
GetAttachmentResponse'
(Maybe Text -> Maybe Text -> Int -> GetAttachmentResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetAttachmentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UrlExpiry")
Either String (Maybe Text -> Int -> GetAttachmentResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetAttachmentResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Url")
Either String (Int -> GetAttachmentResponse)
-> Either String Int -> Either String GetAttachmentResponse
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 GetAttachment
instance Prelude.NFData GetAttachment
instance Core.ToHeaders GetAttachment where
toHeaders :: GetAttachment -> ResponseHeaders
toHeaders GetAttachment' {Text
connectionToken :: Text
attachmentId :: Text
$sel:connectionToken:GetAttachment' :: GetAttachment -> Text
$sel:attachmentId:GetAttachment' :: GetAttachment -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Bearer" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
connectionToken,
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 GetAttachment where
toJSON :: GetAttachment -> Value
toJSON GetAttachment' {Text
connectionToken :: Text
attachmentId :: Text
$sel:connectionToken:GetAttachment' :: GetAttachment -> Text
$sel:attachmentId:GetAttachment' :: GetAttachment -> 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 GetAttachment where
toPath :: GetAttachment -> ByteString
toPath = ByteString -> GetAttachment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/participant/attachment"
instance Core.ToQuery GetAttachment where
toQuery :: GetAttachment -> QueryString
toQuery = QueryString -> GetAttachment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetAttachmentResponse = GetAttachmentResponse'
{
GetAttachmentResponse -> Maybe Text
urlExpiry :: Prelude.Maybe Prelude.Text,
GetAttachmentResponse -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
GetAttachmentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAttachmentResponse -> GetAttachmentResponse -> Bool
(GetAttachmentResponse -> GetAttachmentResponse -> Bool)
-> (GetAttachmentResponse -> GetAttachmentResponse -> Bool)
-> Eq GetAttachmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttachmentResponse -> GetAttachmentResponse -> Bool
$c/= :: GetAttachmentResponse -> GetAttachmentResponse -> Bool
== :: GetAttachmentResponse -> GetAttachmentResponse -> Bool
$c== :: GetAttachmentResponse -> GetAttachmentResponse -> Bool
Prelude.Eq, ReadPrec [GetAttachmentResponse]
ReadPrec GetAttachmentResponse
Int -> ReadS GetAttachmentResponse
ReadS [GetAttachmentResponse]
(Int -> ReadS GetAttachmentResponse)
-> ReadS [GetAttachmentResponse]
-> ReadPrec GetAttachmentResponse
-> ReadPrec [GetAttachmentResponse]
-> Read GetAttachmentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAttachmentResponse]
$creadListPrec :: ReadPrec [GetAttachmentResponse]
readPrec :: ReadPrec GetAttachmentResponse
$creadPrec :: ReadPrec GetAttachmentResponse
readList :: ReadS [GetAttachmentResponse]
$creadList :: ReadS [GetAttachmentResponse]
readsPrec :: Int -> ReadS GetAttachmentResponse
$creadsPrec :: Int -> ReadS GetAttachmentResponse
Prelude.Read, Int -> GetAttachmentResponse -> ShowS
[GetAttachmentResponse] -> ShowS
GetAttachmentResponse -> String
(Int -> GetAttachmentResponse -> ShowS)
-> (GetAttachmentResponse -> String)
-> ([GetAttachmentResponse] -> ShowS)
-> Show GetAttachmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAttachmentResponse] -> ShowS
$cshowList :: [GetAttachmentResponse] -> ShowS
show :: GetAttachmentResponse -> String
$cshow :: GetAttachmentResponse -> String
showsPrec :: Int -> GetAttachmentResponse -> ShowS
$cshowsPrec :: Int -> GetAttachmentResponse -> ShowS
Prelude.Show, (forall x. GetAttachmentResponse -> Rep GetAttachmentResponse x)
-> (forall x. Rep GetAttachmentResponse x -> GetAttachmentResponse)
-> Generic GetAttachmentResponse
forall x. Rep GetAttachmentResponse x -> GetAttachmentResponse
forall x. GetAttachmentResponse -> Rep GetAttachmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAttachmentResponse x -> GetAttachmentResponse
$cfrom :: forall x. GetAttachmentResponse -> Rep GetAttachmentResponse x
Prelude.Generic)
newGetAttachmentResponse ::
Prelude.Int ->
GetAttachmentResponse
newGetAttachmentResponse :: Int -> GetAttachmentResponse
newGetAttachmentResponse Int
pHttpStatus_ =
GetAttachmentResponse' :: Maybe Text -> Maybe Text -> Int -> GetAttachmentResponse
GetAttachmentResponse'
{ $sel:urlExpiry:GetAttachmentResponse' :: Maybe Text
urlExpiry = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:url:GetAttachmentResponse' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAttachmentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAttachmentResponse_urlExpiry :: Lens.Lens' GetAttachmentResponse (Prelude.Maybe Prelude.Text)
getAttachmentResponse_urlExpiry :: (Maybe Text -> f (Maybe Text))
-> GetAttachmentResponse -> f GetAttachmentResponse
getAttachmentResponse_urlExpiry = (GetAttachmentResponse -> Maybe Text)
-> (GetAttachmentResponse -> Maybe Text -> GetAttachmentResponse)
-> Lens
GetAttachmentResponse
GetAttachmentResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttachmentResponse' {Maybe Text
urlExpiry :: Maybe Text
$sel:urlExpiry:GetAttachmentResponse' :: GetAttachmentResponse -> Maybe Text
urlExpiry} -> Maybe Text
urlExpiry) (\s :: GetAttachmentResponse
s@GetAttachmentResponse' {} Maybe Text
a -> GetAttachmentResponse
s {$sel:urlExpiry:GetAttachmentResponse' :: Maybe Text
urlExpiry = Maybe Text
a} :: GetAttachmentResponse)
getAttachmentResponse_url :: Lens.Lens' GetAttachmentResponse (Prelude.Maybe Prelude.Text)
getAttachmentResponse_url :: (Maybe Text -> f (Maybe Text))
-> GetAttachmentResponse -> f GetAttachmentResponse
getAttachmentResponse_url = (GetAttachmentResponse -> Maybe Text)
-> (GetAttachmentResponse -> Maybe Text -> GetAttachmentResponse)
-> Lens
GetAttachmentResponse
GetAttachmentResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttachmentResponse' {Maybe Text
url :: Maybe Text
$sel:url:GetAttachmentResponse' :: GetAttachmentResponse -> Maybe Text
url} -> Maybe Text
url) (\s :: GetAttachmentResponse
s@GetAttachmentResponse' {} Maybe Text
a -> GetAttachmentResponse
s {$sel:url:GetAttachmentResponse' :: Maybe Text
url = Maybe Text
a} :: GetAttachmentResponse)
getAttachmentResponse_httpStatus :: Lens.Lens' GetAttachmentResponse Prelude.Int
getAttachmentResponse_httpStatus :: (Int -> f Int) -> GetAttachmentResponse -> f GetAttachmentResponse
getAttachmentResponse_httpStatus = (GetAttachmentResponse -> Int)
-> (GetAttachmentResponse -> Int -> GetAttachmentResponse)
-> Lens GetAttachmentResponse GetAttachmentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttachmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAttachmentResponse' :: GetAttachmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAttachmentResponse
s@GetAttachmentResponse' {} Int
a -> GetAttachmentResponse
s {$sel:httpStatus:GetAttachmentResponse' :: Int
httpStatus = Int
a} :: GetAttachmentResponse)
instance Prelude.NFData GetAttachmentResponse