{-# 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.AlexaBusiness.AssociateContactWithAddressBook
(
AssociateContactWithAddressBook (..),
newAssociateContactWithAddressBook,
associateContactWithAddressBook_contactArn,
associateContactWithAddressBook_addressBookArn,
AssociateContactWithAddressBookResponse (..),
newAssociateContactWithAddressBookResponse,
associateContactWithAddressBookResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.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 AssociateContactWithAddressBook = AssociateContactWithAddressBook'
{
AssociateContactWithAddressBook -> Text
contactArn :: Prelude.Text,
AssociateContactWithAddressBook -> Text
addressBookArn :: Prelude.Text
}
deriving (AssociateContactWithAddressBook
-> AssociateContactWithAddressBook -> Bool
(AssociateContactWithAddressBook
-> AssociateContactWithAddressBook -> Bool)
-> (AssociateContactWithAddressBook
-> AssociateContactWithAddressBook -> Bool)
-> Eq AssociateContactWithAddressBook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateContactWithAddressBook
-> AssociateContactWithAddressBook -> Bool
$c/= :: AssociateContactWithAddressBook
-> AssociateContactWithAddressBook -> Bool
== :: AssociateContactWithAddressBook
-> AssociateContactWithAddressBook -> Bool
$c== :: AssociateContactWithAddressBook
-> AssociateContactWithAddressBook -> Bool
Prelude.Eq, ReadPrec [AssociateContactWithAddressBook]
ReadPrec AssociateContactWithAddressBook
Int -> ReadS AssociateContactWithAddressBook
ReadS [AssociateContactWithAddressBook]
(Int -> ReadS AssociateContactWithAddressBook)
-> ReadS [AssociateContactWithAddressBook]
-> ReadPrec AssociateContactWithAddressBook
-> ReadPrec [AssociateContactWithAddressBook]
-> Read AssociateContactWithAddressBook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateContactWithAddressBook]
$creadListPrec :: ReadPrec [AssociateContactWithAddressBook]
readPrec :: ReadPrec AssociateContactWithAddressBook
$creadPrec :: ReadPrec AssociateContactWithAddressBook
readList :: ReadS [AssociateContactWithAddressBook]
$creadList :: ReadS [AssociateContactWithAddressBook]
readsPrec :: Int -> ReadS AssociateContactWithAddressBook
$creadsPrec :: Int -> ReadS AssociateContactWithAddressBook
Prelude.Read, Int -> AssociateContactWithAddressBook -> ShowS
[AssociateContactWithAddressBook] -> ShowS
AssociateContactWithAddressBook -> String
(Int -> AssociateContactWithAddressBook -> ShowS)
-> (AssociateContactWithAddressBook -> String)
-> ([AssociateContactWithAddressBook] -> ShowS)
-> Show AssociateContactWithAddressBook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateContactWithAddressBook] -> ShowS
$cshowList :: [AssociateContactWithAddressBook] -> ShowS
show :: AssociateContactWithAddressBook -> String
$cshow :: AssociateContactWithAddressBook -> String
showsPrec :: Int -> AssociateContactWithAddressBook -> ShowS
$cshowsPrec :: Int -> AssociateContactWithAddressBook -> ShowS
Prelude.Show, (forall x.
AssociateContactWithAddressBook
-> Rep AssociateContactWithAddressBook x)
-> (forall x.
Rep AssociateContactWithAddressBook x
-> AssociateContactWithAddressBook)
-> Generic AssociateContactWithAddressBook
forall x.
Rep AssociateContactWithAddressBook x
-> AssociateContactWithAddressBook
forall x.
AssociateContactWithAddressBook
-> Rep AssociateContactWithAddressBook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateContactWithAddressBook x
-> AssociateContactWithAddressBook
$cfrom :: forall x.
AssociateContactWithAddressBook
-> Rep AssociateContactWithAddressBook x
Prelude.Generic)
newAssociateContactWithAddressBook ::
Prelude.Text ->
Prelude.Text ->
AssociateContactWithAddressBook
newAssociateContactWithAddressBook :: Text -> Text -> AssociateContactWithAddressBook
newAssociateContactWithAddressBook
Text
pContactArn_
Text
pAddressBookArn_ =
AssociateContactWithAddressBook' :: Text -> Text -> AssociateContactWithAddressBook
AssociateContactWithAddressBook'
{ $sel:contactArn:AssociateContactWithAddressBook' :: Text
contactArn =
Text
pContactArn_,
$sel:addressBookArn:AssociateContactWithAddressBook' :: Text
addressBookArn = Text
pAddressBookArn_
}
associateContactWithAddressBook_contactArn :: Lens.Lens' AssociateContactWithAddressBook Prelude.Text
associateContactWithAddressBook_contactArn :: (Text -> f Text)
-> AssociateContactWithAddressBook
-> f AssociateContactWithAddressBook
associateContactWithAddressBook_contactArn = (AssociateContactWithAddressBook -> Text)
-> (AssociateContactWithAddressBook
-> Text -> AssociateContactWithAddressBook)
-> Lens
AssociateContactWithAddressBook
AssociateContactWithAddressBook
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateContactWithAddressBook' {Text
contactArn :: Text
$sel:contactArn:AssociateContactWithAddressBook' :: AssociateContactWithAddressBook -> Text
contactArn} -> Text
contactArn) (\s :: AssociateContactWithAddressBook
s@AssociateContactWithAddressBook' {} Text
a -> AssociateContactWithAddressBook
s {$sel:contactArn:AssociateContactWithAddressBook' :: Text
contactArn = Text
a} :: AssociateContactWithAddressBook)
associateContactWithAddressBook_addressBookArn :: Lens.Lens' AssociateContactWithAddressBook Prelude.Text
associateContactWithAddressBook_addressBookArn :: (Text -> f Text)
-> AssociateContactWithAddressBook
-> f AssociateContactWithAddressBook
associateContactWithAddressBook_addressBookArn = (AssociateContactWithAddressBook -> Text)
-> (AssociateContactWithAddressBook
-> Text -> AssociateContactWithAddressBook)
-> Lens
AssociateContactWithAddressBook
AssociateContactWithAddressBook
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateContactWithAddressBook' {Text
addressBookArn :: Text
$sel:addressBookArn:AssociateContactWithAddressBook' :: AssociateContactWithAddressBook -> Text
addressBookArn} -> Text
addressBookArn) (\s :: AssociateContactWithAddressBook
s@AssociateContactWithAddressBook' {} Text
a -> AssociateContactWithAddressBook
s {$sel:addressBookArn:AssociateContactWithAddressBook' :: Text
addressBookArn = Text
a} :: AssociateContactWithAddressBook)
instance
Core.AWSRequest
AssociateContactWithAddressBook
where
type
AWSResponse AssociateContactWithAddressBook =
AssociateContactWithAddressBookResponse
request :: AssociateContactWithAddressBook
-> Request AssociateContactWithAddressBook
request = Service
-> AssociateContactWithAddressBook
-> Request AssociateContactWithAddressBook
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateContactWithAddressBook
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse AssociateContactWithAddressBook)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AssociateContactWithAddressBook))
-> Logger
-> Service
-> Proxy AssociateContactWithAddressBook
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse AssociateContactWithAddressBook)))
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 -> AssociateContactWithAddressBookResponse
AssociateContactWithAddressBookResponse'
(Int -> AssociateContactWithAddressBookResponse)
-> Either String Int
-> Either String AssociateContactWithAddressBookResponse
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
AssociateContactWithAddressBook
instance
Prelude.NFData
AssociateContactWithAddressBook
instance
Core.ToHeaders
AssociateContactWithAddressBook
where
toHeaders :: AssociateContactWithAddressBook -> ResponseHeaders
toHeaders =
ResponseHeaders
-> AssociateContactWithAddressBook -> 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
"AlexaForBusiness.AssociateContactWithAddressBook" ::
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 AssociateContactWithAddressBook where
toJSON :: AssociateContactWithAddressBook -> Value
toJSON AssociateContactWithAddressBook' {Text
addressBookArn :: Text
contactArn :: Text
$sel:addressBookArn:AssociateContactWithAddressBook' :: AssociateContactWithAddressBook -> Text
$sel:contactArn:AssociateContactWithAddressBook' :: AssociateContactWithAddressBook -> 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
"ContactArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AddressBookArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
addressBookArn)
]
)
instance Core.ToPath AssociateContactWithAddressBook where
toPath :: AssociateContactWithAddressBook -> ByteString
toPath = ByteString -> AssociateContactWithAddressBook -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateContactWithAddressBook where
toQuery :: AssociateContactWithAddressBook -> QueryString
toQuery = QueryString -> AssociateContactWithAddressBook -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateContactWithAddressBookResponse = AssociateContactWithAddressBookResponse'
{
AssociateContactWithAddressBookResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateContactWithAddressBookResponse
-> AssociateContactWithAddressBookResponse -> Bool
(AssociateContactWithAddressBookResponse
-> AssociateContactWithAddressBookResponse -> Bool)
-> (AssociateContactWithAddressBookResponse
-> AssociateContactWithAddressBookResponse -> Bool)
-> Eq AssociateContactWithAddressBookResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateContactWithAddressBookResponse
-> AssociateContactWithAddressBookResponse -> Bool
$c/= :: AssociateContactWithAddressBookResponse
-> AssociateContactWithAddressBookResponse -> Bool
== :: AssociateContactWithAddressBookResponse
-> AssociateContactWithAddressBookResponse -> Bool
$c== :: AssociateContactWithAddressBookResponse
-> AssociateContactWithAddressBookResponse -> Bool
Prelude.Eq, ReadPrec [AssociateContactWithAddressBookResponse]
ReadPrec AssociateContactWithAddressBookResponse
Int -> ReadS AssociateContactWithAddressBookResponse
ReadS [AssociateContactWithAddressBookResponse]
(Int -> ReadS AssociateContactWithAddressBookResponse)
-> ReadS [AssociateContactWithAddressBookResponse]
-> ReadPrec AssociateContactWithAddressBookResponse
-> ReadPrec [AssociateContactWithAddressBookResponse]
-> Read AssociateContactWithAddressBookResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateContactWithAddressBookResponse]
$creadListPrec :: ReadPrec [AssociateContactWithAddressBookResponse]
readPrec :: ReadPrec AssociateContactWithAddressBookResponse
$creadPrec :: ReadPrec AssociateContactWithAddressBookResponse
readList :: ReadS [AssociateContactWithAddressBookResponse]
$creadList :: ReadS [AssociateContactWithAddressBookResponse]
readsPrec :: Int -> ReadS AssociateContactWithAddressBookResponse
$creadsPrec :: Int -> ReadS AssociateContactWithAddressBookResponse
Prelude.Read, Int -> AssociateContactWithAddressBookResponse -> ShowS
[AssociateContactWithAddressBookResponse] -> ShowS
AssociateContactWithAddressBookResponse -> String
(Int -> AssociateContactWithAddressBookResponse -> ShowS)
-> (AssociateContactWithAddressBookResponse -> String)
-> ([AssociateContactWithAddressBookResponse] -> ShowS)
-> Show AssociateContactWithAddressBookResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateContactWithAddressBookResponse] -> ShowS
$cshowList :: [AssociateContactWithAddressBookResponse] -> ShowS
show :: AssociateContactWithAddressBookResponse -> String
$cshow :: AssociateContactWithAddressBookResponse -> String
showsPrec :: Int -> AssociateContactWithAddressBookResponse -> ShowS
$cshowsPrec :: Int -> AssociateContactWithAddressBookResponse -> ShowS
Prelude.Show, (forall x.
AssociateContactWithAddressBookResponse
-> Rep AssociateContactWithAddressBookResponse x)
-> (forall x.
Rep AssociateContactWithAddressBookResponse x
-> AssociateContactWithAddressBookResponse)
-> Generic AssociateContactWithAddressBookResponse
forall x.
Rep AssociateContactWithAddressBookResponse x
-> AssociateContactWithAddressBookResponse
forall x.
AssociateContactWithAddressBookResponse
-> Rep AssociateContactWithAddressBookResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateContactWithAddressBookResponse x
-> AssociateContactWithAddressBookResponse
$cfrom :: forall x.
AssociateContactWithAddressBookResponse
-> Rep AssociateContactWithAddressBookResponse x
Prelude.Generic)
newAssociateContactWithAddressBookResponse ::
Prelude.Int ->
AssociateContactWithAddressBookResponse
newAssociateContactWithAddressBookResponse :: Int -> AssociateContactWithAddressBookResponse
newAssociateContactWithAddressBookResponse
Int
pHttpStatus_ =
AssociateContactWithAddressBookResponse' :: Int -> AssociateContactWithAddressBookResponse
AssociateContactWithAddressBookResponse'
{ $sel:httpStatus:AssociateContactWithAddressBookResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateContactWithAddressBookResponse_httpStatus :: Lens.Lens' AssociateContactWithAddressBookResponse Prelude.Int
associateContactWithAddressBookResponse_httpStatus :: (Int -> f Int)
-> AssociateContactWithAddressBookResponse
-> f AssociateContactWithAddressBookResponse
associateContactWithAddressBookResponse_httpStatus = (AssociateContactWithAddressBookResponse -> Int)
-> (AssociateContactWithAddressBookResponse
-> Int -> AssociateContactWithAddressBookResponse)
-> Lens
AssociateContactWithAddressBookResponse
AssociateContactWithAddressBookResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateContactWithAddressBookResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateContactWithAddressBookResponse' :: AssociateContactWithAddressBookResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateContactWithAddressBookResponse
s@AssociateContactWithAddressBookResponse' {} Int
a -> AssociateContactWithAddressBookResponse
s {$sel:httpStatus:AssociateContactWithAddressBookResponse' :: Int
httpStatus = Int
a} :: AssociateContactWithAddressBookResponse)
instance
Prelude.NFData
AssociateContactWithAddressBookResponse