{-# 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.SESV2.UpdateContactList
(
UpdateContactList (..),
newUpdateContactList,
updateContactList_topics,
updateContactList_description,
updateContactList_contactListName,
UpdateContactListResponse (..),
newUpdateContactListResponse,
updateContactListResponse_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.SESV2.Types
data UpdateContactList = UpdateContactList'
{
UpdateContactList -> Maybe [Topic]
topics :: Prelude.Maybe [Topic],
UpdateContactList -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateContactList -> Text
contactListName :: Prelude.Text
}
deriving (UpdateContactList -> UpdateContactList -> Bool
(UpdateContactList -> UpdateContactList -> Bool)
-> (UpdateContactList -> UpdateContactList -> Bool)
-> Eq UpdateContactList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContactList -> UpdateContactList -> Bool
$c/= :: UpdateContactList -> UpdateContactList -> Bool
== :: UpdateContactList -> UpdateContactList -> Bool
$c== :: UpdateContactList -> UpdateContactList -> Bool
Prelude.Eq, ReadPrec [UpdateContactList]
ReadPrec UpdateContactList
Int -> ReadS UpdateContactList
ReadS [UpdateContactList]
(Int -> ReadS UpdateContactList)
-> ReadS [UpdateContactList]
-> ReadPrec UpdateContactList
-> ReadPrec [UpdateContactList]
-> Read UpdateContactList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContactList]
$creadListPrec :: ReadPrec [UpdateContactList]
readPrec :: ReadPrec UpdateContactList
$creadPrec :: ReadPrec UpdateContactList
readList :: ReadS [UpdateContactList]
$creadList :: ReadS [UpdateContactList]
readsPrec :: Int -> ReadS UpdateContactList
$creadsPrec :: Int -> ReadS UpdateContactList
Prelude.Read, Int -> UpdateContactList -> ShowS
[UpdateContactList] -> ShowS
UpdateContactList -> String
(Int -> UpdateContactList -> ShowS)
-> (UpdateContactList -> String)
-> ([UpdateContactList] -> ShowS)
-> Show UpdateContactList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContactList] -> ShowS
$cshowList :: [UpdateContactList] -> ShowS
show :: UpdateContactList -> String
$cshow :: UpdateContactList -> String
showsPrec :: Int -> UpdateContactList -> ShowS
$cshowsPrec :: Int -> UpdateContactList -> ShowS
Prelude.Show, (forall x. UpdateContactList -> Rep UpdateContactList x)
-> (forall x. Rep UpdateContactList x -> UpdateContactList)
-> Generic UpdateContactList
forall x. Rep UpdateContactList x -> UpdateContactList
forall x. UpdateContactList -> Rep UpdateContactList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateContactList x -> UpdateContactList
$cfrom :: forall x. UpdateContactList -> Rep UpdateContactList x
Prelude.Generic)
newUpdateContactList ::
Prelude.Text ->
UpdateContactList
newUpdateContactList :: Text -> UpdateContactList
newUpdateContactList Text
pContactListName_ =
UpdateContactList' :: Maybe [Topic] -> Maybe Text -> Text -> UpdateContactList
UpdateContactList'
{ $sel:topics:UpdateContactList' :: Maybe [Topic]
topics = Maybe [Topic]
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateContactList' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contactListName:UpdateContactList' :: Text
contactListName = Text
pContactListName_
}
updateContactList_topics :: Lens.Lens' UpdateContactList (Prelude.Maybe [Topic])
updateContactList_topics :: (Maybe [Topic] -> f (Maybe [Topic]))
-> UpdateContactList -> f UpdateContactList
updateContactList_topics = (UpdateContactList -> Maybe [Topic])
-> (UpdateContactList -> Maybe [Topic] -> UpdateContactList)
-> Lens
UpdateContactList UpdateContactList (Maybe [Topic]) (Maybe [Topic])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactList' {Maybe [Topic]
topics :: Maybe [Topic]
$sel:topics:UpdateContactList' :: UpdateContactList -> Maybe [Topic]
topics} -> Maybe [Topic]
topics) (\s :: UpdateContactList
s@UpdateContactList' {} Maybe [Topic]
a -> UpdateContactList
s {$sel:topics:UpdateContactList' :: Maybe [Topic]
topics = Maybe [Topic]
a} :: UpdateContactList) ((Maybe [Topic] -> f (Maybe [Topic]))
-> UpdateContactList -> f UpdateContactList)
-> ((Maybe [Topic] -> f (Maybe [Topic]))
-> Maybe [Topic] -> f (Maybe [Topic]))
-> (Maybe [Topic] -> f (Maybe [Topic]))
-> UpdateContactList
-> f UpdateContactList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Topic] [Topic] [Topic] [Topic]
-> Iso
(Maybe [Topic]) (Maybe [Topic]) (Maybe [Topic]) (Maybe [Topic])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Topic] [Topic] [Topic] [Topic]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateContactList_description :: Lens.Lens' UpdateContactList (Prelude.Maybe Prelude.Text)
updateContactList_description :: (Maybe Text -> f (Maybe Text))
-> UpdateContactList -> f UpdateContactList
updateContactList_description = (UpdateContactList -> Maybe Text)
-> (UpdateContactList -> Maybe Text -> UpdateContactList)
-> Lens
UpdateContactList UpdateContactList (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactList' {Maybe Text
description :: Maybe Text
$sel:description:UpdateContactList' :: UpdateContactList -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateContactList
s@UpdateContactList' {} Maybe Text
a -> UpdateContactList
s {$sel:description:UpdateContactList' :: Maybe Text
description = Maybe Text
a} :: UpdateContactList)
updateContactList_contactListName :: Lens.Lens' UpdateContactList Prelude.Text
updateContactList_contactListName :: (Text -> f Text) -> UpdateContactList -> f UpdateContactList
updateContactList_contactListName = (UpdateContactList -> Text)
-> (UpdateContactList -> Text -> UpdateContactList)
-> Lens UpdateContactList UpdateContactList Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactList' {Text
contactListName :: Text
$sel:contactListName:UpdateContactList' :: UpdateContactList -> Text
contactListName} -> Text
contactListName) (\s :: UpdateContactList
s@UpdateContactList' {} Text
a -> UpdateContactList
s {$sel:contactListName:UpdateContactList' :: Text
contactListName = Text
a} :: UpdateContactList)
instance Core.AWSRequest UpdateContactList where
type
AWSResponse UpdateContactList =
UpdateContactListResponse
request :: UpdateContactList -> Request UpdateContactList
request = Service -> UpdateContactList -> Request UpdateContactList
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateContactList
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateContactList)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateContactList))
-> Logger
-> Service
-> Proxy UpdateContactList
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateContactList)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateContactListResponse
UpdateContactListResponse'
(Int -> UpdateContactListResponse)
-> Either String Int -> Either String UpdateContactListResponse
forall (f :: * -> *) a b. Functor 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 UpdateContactList
instance Prelude.NFData UpdateContactList
instance Core.ToHeaders UpdateContactList where
toHeaders :: UpdateContactList -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateContactList -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateContactList where
toJSON :: UpdateContactList -> Value
toJSON UpdateContactList' {Maybe [Topic]
Maybe Text
Text
contactListName :: Text
description :: Maybe Text
topics :: Maybe [Topic]
$sel:contactListName:UpdateContactList' :: UpdateContactList -> Text
$sel:description:UpdateContactList' :: UpdateContactList -> Maybe Text
$sel:topics:UpdateContactList' :: UpdateContactList -> Maybe [Topic]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Topics" Text -> [Topic] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Topic] -> Pair) -> Maybe [Topic] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Topic]
topics,
(Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description
]
)
instance Core.ToPath UpdateContactList where
toPath :: UpdateContactList -> ByteString
toPath UpdateContactList' {Maybe [Topic]
Maybe Text
Text
contactListName :: Text
description :: Maybe Text
topics :: Maybe [Topic]
$sel:contactListName:UpdateContactList' :: UpdateContactList -> Text
$sel:description:UpdateContactList' :: UpdateContactList -> Maybe Text
$sel:topics:UpdateContactList' :: UpdateContactList -> Maybe [Topic]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/email/contact-lists/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
contactListName
]
instance Core.ToQuery UpdateContactList where
toQuery :: UpdateContactList -> QueryString
toQuery = QueryString -> UpdateContactList -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateContactListResponse = UpdateContactListResponse'
{
UpdateContactListResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateContactListResponse -> UpdateContactListResponse -> Bool
(UpdateContactListResponse -> UpdateContactListResponse -> Bool)
-> (UpdateContactListResponse -> UpdateContactListResponse -> Bool)
-> Eq UpdateContactListResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContactListResponse -> UpdateContactListResponse -> Bool
$c/= :: UpdateContactListResponse -> UpdateContactListResponse -> Bool
== :: UpdateContactListResponse -> UpdateContactListResponse -> Bool
$c== :: UpdateContactListResponse -> UpdateContactListResponse -> Bool
Prelude.Eq, ReadPrec [UpdateContactListResponse]
ReadPrec UpdateContactListResponse
Int -> ReadS UpdateContactListResponse
ReadS [UpdateContactListResponse]
(Int -> ReadS UpdateContactListResponse)
-> ReadS [UpdateContactListResponse]
-> ReadPrec UpdateContactListResponse
-> ReadPrec [UpdateContactListResponse]
-> Read UpdateContactListResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContactListResponse]
$creadListPrec :: ReadPrec [UpdateContactListResponse]
readPrec :: ReadPrec UpdateContactListResponse
$creadPrec :: ReadPrec UpdateContactListResponse
readList :: ReadS [UpdateContactListResponse]
$creadList :: ReadS [UpdateContactListResponse]
readsPrec :: Int -> ReadS UpdateContactListResponse
$creadsPrec :: Int -> ReadS UpdateContactListResponse
Prelude.Read, Int -> UpdateContactListResponse -> ShowS
[UpdateContactListResponse] -> ShowS
UpdateContactListResponse -> String
(Int -> UpdateContactListResponse -> ShowS)
-> (UpdateContactListResponse -> String)
-> ([UpdateContactListResponse] -> ShowS)
-> Show UpdateContactListResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContactListResponse] -> ShowS
$cshowList :: [UpdateContactListResponse] -> ShowS
show :: UpdateContactListResponse -> String
$cshow :: UpdateContactListResponse -> String
showsPrec :: Int -> UpdateContactListResponse -> ShowS
$cshowsPrec :: Int -> UpdateContactListResponse -> ShowS
Prelude.Show, (forall x.
UpdateContactListResponse -> Rep UpdateContactListResponse x)
-> (forall x.
Rep UpdateContactListResponse x -> UpdateContactListResponse)
-> Generic UpdateContactListResponse
forall x.
Rep UpdateContactListResponse x -> UpdateContactListResponse
forall x.
UpdateContactListResponse -> Rep UpdateContactListResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateContactListResponse x -> UpdateContactListResponse
$cfrom :: forall x.
UpdateContactListResponse -> Rep UpdateContactListResponse x
Prelude.Generic)
newUpdateContactListResponse ::
Prelude.Int ->
UpdateContactListResponse
newUpdateContactListResponse :: Int -> UpdateContactListResponse
newUpdateContactListResponse Int
pHttpStatus_ =
UpdateContactListResponse' :: Int -> UpdateContactListResponse
UpdateContactListResponse'
{ $sel:httpStatus:UpdateContactListResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateContactListResponse_httpStatus :: Lens.Lens' UpdateContactListResponse Prelude.Int
updateContactListResponse_httpStatus :: (Int -> f Int)
-> UpdateContactListResponse -> f UpdateContactListResponse
updateContactListResponse_httpStatus = (UpdateContactListResponse -> Int)
-> (UpdateContactListResponse -> Int -> UpdateContactListResponse)
-> Lens UpdateContactListResponse UpdateContactListResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactListResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateContactListResponse' :: UpdateContactListResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateContactListResponse
s@UpdateContactListResponse' {} Int
a -> UpdateContactListResponse
s {$sel:httpStatus:UpdateContactListResponse' :: Int
httpStatus = Int
a} :: UpdateContactListResponse)
instance Prelude.NFData UpdateContactListResponse