{-# 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.CreateAddressBook
(
CreateAddressBook (..),
newCreateAddressBook,
createAddressBook_clientRequestToken,
createAddressBook_description,
createAddressBook_tags,
createAddressBook_name,
CreateAddressBookResponse (..),
newCreateAddressBookResponse,
createAddressBookResponse_addressBookArn,
createAddressBookResponse_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 CreateAddressBook = CreateAddressBook'
{
CreateAddressBook -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
CreateAddressBook -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateAddressBook -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateAddressBook -> Text
name :: Prelude.Text
}
deriving (CreateAddressBook -> CreateAddressBook -> Bool
(CreateAddressBook -> CreateAddressBook -> Bool)
-> (CreateAddressBook -> CreateAddressBook -> Bool)
-> Eq CreateAddressBook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAddressBook -> CreateAddressBook -> Bool
$c/= :: CreateAddressBook -> CreateAddressBook -> Bool
== :: CreateAddressBook -> CreateAddressBook -> Bool
$c== :: CreateAddressBook -> CreateAddressBook -> Bool
Prelude.Eq, ReadPrec [CreateAddressBook]
ReadPrec CreateAddressBook
Int -> ReadS CreateAddressBook
ReadS [CreateAddressBook]
(Int -> ReadS CreateAddressBook)
-> ReadS [CreateAddressBook]
-> ReadPrec CreateAddressBook
-> ReadPrec [CreateAddressBook]
-> Read CreateAddressBook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAddressBook]
$creadListPrec :: ReadPrec [CreateAddressBook]
readPrec :: ReadPrec CreateAddressBook
$creadPrec :: ReadPrec CreateAddressBook
readList :: ReadS [CreateAddressBook]
$creadList :: ReadS [CreateAddressBook]
readsPrec :: Int -> ReadS CreateAddressBook
$creadsPrec :: Int -> ReadS CreateAddressBook
Prelude.Read, Int -> CreateAddressBook -> ShowS
[CreateAddressBook] -> ShowS
CreateAddressBook -> String
(Int -> CreateAddressBook -> ShowS)
-> (CreateAddressBook -> String)
-> ([CreateAddressBook] -> ShowS)
-> Show CreateAddressBook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAddressBook] -> ShowS
$cshowList :: [CreateAddressBook] -> ShowS
show :: CreateAddressBook -> String
$cshow :: CreateAddressBook -> String
showsPrec :: Int -> CreateAddressBook -> ShowS
$cshowsPrec :: Int -> CreateAddressBook -> ShowS
Prelude.Show, (forall x. CreateAddressBook -> Rep CreateAddressBook x)
-> (forall x. Rep CreateAddressBook x -> CreateAddressBook)
-> Generic CreateAddressBook
forall x. Rep CreateAddressBook x -> CreateAddressBook
forall x. CreateAddressBook -> Rep CreateAddressBook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAddressBook x -> CreateAddressBook
$cfrom :: forall x. CreateAddressBook -> Rep CreateAddressBook x
Prelude.Generic)
newCreateAddressBook ::
Prelude.Text ->
CreateAddressBook
newCreateAddressBook :: Text -> CreateAddressBook
newCreateAddressBook Text
pName_ =
CreateAddressBook' :: Maybe Text
-> Maybe Text -> Maybe [Tag] -> Text -> CreateAddressBook
CreateAddressBook'
{ $sel:clientRequestToken:CreateAddressBook' :: Maybe Text
clientRequestToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateAddressBook' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateAddressBook' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateAddressBook' :: Text
name = Text
pName_
}
createAddressBook_clientRequestToken :: Lens.Lens' CreateAddressBook (Prelude.Maybe Prelude.Text)
createAddressBook_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> CreateAddressBook -> f CreateAddressBook
createAddressBook_clientRequestToken = (CreateAddressBook -> Maybe Text)
-> (CreateAddressBook -> Maybe Text -> CreateAddressBook)
-> Lens
CreateAddressBook CreateAddressBook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressBook' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateAddressBook' :: CreateAddressBook -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateAddressBook
s@CreateAddressBook' {} Maybe Text
a -> CreateAddressBook
s {$sel:clientRequestToken:CreateAddressBook' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateAddressBook)
createAddressBook_description :: Lens.Lens' CreateAddressBook (Prelude.Maybe Prelude.Text)
createAddressBook_description :: (Maybe Text -> f (Maybe Text))
-> CreateAddressBook -> f CreateAddressBook
createAddressBook_description = (CreateAddressBook -> Maybe Text)
-> (CreateAddressBook -> Maybe Text -> CreateAddressBook)
-> Lens
CreateAddressBook CreateAddressBook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressBook' {Maybe Text
description :: Maybe Text
$sel:description:CreateAddressBook' :: CreateAddressBook -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateAddressBook
s@CreateAddressBook' {} Maybe Text
a -> CreateAddressBook
s {$sel:description:CreateAddressBook' :: Maybe Text
description = Maybe Text
a} :: CreateAddressBook)
createAddressBook_tags :: Lens.Lens' CreateAddressBook (Prelude.Maybe [Tag])
createAddressBook_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAddressBook -> f CreateAddressBook
createAddressBook_tags = (CreateAddressBook -> Maybe [Tag])
-> (CreateAddressBook -> Maybe [Tag] -> CreateAddressBook)
-> Lens
CreateAddressBook CreateAddressBook (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressBook' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAddressBook' :: CreateAddressBook -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAddressBook
s@CreateAddressBook' {} Maybe [Tag]
a -> CreateAddressBook
s {$sel:tags:CreateAddressBook' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAddressBook) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAddressBook -> f CreateAddressBook)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAddressBook
-> f CreateAddressBook
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAddressBook_name :: Lens.Lens' CreateAddressBook Prelude.Text
createAddressBook_name :: (Text -> f Text) -> CreateAddressBook -> f CreateAddressBook
createAddressBook_name = (CreateAddressBook -> Text)
-> (CreateAddressBook -> Text -> CreateAddressBook)
-> Lens CreateAddressBook CreateAddressBook Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressBook' {Text
name :: Text
$sel:name:CreateAddressBook' :: CreateAddressBook -> Text
name} -> Text
name) (\s :: CreateAddressBook
s@CreateAddressBook' {} Text
a -> CreateAddressBook
s {$sel:name:CreateAddressBook' :: Text
name = Text
a} :: CreateAddressBook)
instance Core.AWSRequest CreateAddressBook where
type
AWSResponse CreateAddressBook =
CreateAddressBookResponse
request :: CreateAddressBook -> Request CreateAddressBook
request = Service -> CreateAddressBook -> Request CreateAddressBook
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAddressBook
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAddressBook)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAddressBook))
-> Logger
-> Service
-> Proxy CreateAddressBook
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAddressBook)))
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 -> Int -> CreateAddressBookResponse
CreateAddressBookResponse'
(Maybe Text -> Int -> CreateAddressBookResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateAddressBookResponse)
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
"AddressBookArn")
Either String (Int -> CreateAddressBookResponse)
-> Either String Int -> Either String CreateAddressBookResponse
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 CreateAddressBook
instance Prelude.NFData CreateAddressBook
instance Core.ToHeaders CreateAddressBook where
toHeaders :: CreateAddressBook -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateAddressBook -> 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.CreateAddressBook" ::
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 CreateAddressBook where
toJSON :: CreateAddressBook -> Value
toJSON CreateAddressBook' {Maybe [Tag]
Maybe Text
Text
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
clientRequestToken :: Maybe Text
$sel:name:CreateAddressBook' :: CreateAddressBook -> Text
$sel:tags:CreateAddressBook' :: CreateAddressBook -> Maybe [Tag]
$sel:description:CreateAddressBook' :: CreateAddressBook -> Maybe Text
$sel:clientRequestToken:CreateAddressBook' :: CreateAddressBook -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ClientRequestToken" 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
clientRequestToken,
(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,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath CreateAddressBook where
toPath :: CreateAddressBook -> ByteString
toPath = ByteString -> CreateAddressBook -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateAddressBook where
toQuery :: CreateAddressBook -> QueryString
toQuery = QueryString -> CreateAddressBook -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAddressBookResponse = CreateAddressBookResponse'
{
CreateAddressBookResponse -> Maybe Text
addressBookArn :: Prelude.Maybe Prelude.Text,
CreateAddressBookResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateAddressBookResponse -> CreateAddressBookResponse -> Bool
(CreateAddressBookResponse -> CreateAddressBookResponse -> Bool)
-> (CreateAddressBookResponse -> CreateAddressBookResponse -> Bool)
-> Eq CreateAddressBookResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAddressBookResponse -> CreateAddressBookResponse -> Bool
$c/= :: CreateAddressBookResponse -> CreateAddressBookResponse -> Bool
== :: CreateAddressBookResponse -> CreateAddressBookResponse -> Bool
$c== :: CreateAddressBookResponse -> CreateAddressBookResponse -> Bool
Prelude.Eq, ReadPrec [CreateAddressBookResponse]
ReadPrec CreateAddressBookResponse
Int -> ReadS CreateAddressBookResponse
ReadS [CreateAddressBookResponse]
(Int -> ReadS CreateAddressBookResponse)
-> ReadS [CreateAddressBookResponse]
-> ReadPrec CreateAddressBookResponse
-> ReadPrec [CreateAddressBookResponse]
-> Read CreateAddressBookResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAddressBookResponse]
$creadListPrec :: ReadPrec [CreateAddressBookResponse]
readPrec :: ReadPrec CreateAddressBookResponse
$creadPrec :: ReadPrec CreateAddressBookResponse
readList :: ReadS [CreateAddressBookResponse]
$creadList :: ReadS [CreateAddressBookResponse]
readsPrec :: Int -> ReadS CreateAddressBookResponse
$creadsPrec :: Int -> ReadS CreateAddressBookResponse
Prelude.Read, Int -> CreateAddressBookResponse -> ShowS
[CreateAddressBookResponse] -> ShowS
CreateAddressBookResponse -> String
(Int -> CreateAddressBookResponse -> ShowS)
-> (CreateAddressBookResponse -> String)
-> ([CreateAddressBookResponse] -> ShowS)
-> Show CreateAddressBookResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAddressBookResponse] -> ShowS
$cshowList :: [CreateAddressBookResponse] -> ShowS
show :: CreateAddressBookResponse -> String
$cshow :: CreateAddressBookResponse -> String
showsPrec :: Int -> CreateAddressBookResponse -> ShowS
$cshowsPrec :: Int -> CreateAddressBookResponse -> ShowS
Prelude.Show, (forall x.
CreateAddressBookResponse -> Rep CreateAddressBookResponse x)
-> (forall x.
Rep CreateAddressBookResponse x -> CreateAddressBookResponse)
-> Generic CreateAddressBookResponse
forall x.
Rep CreateAddressBookResponse x -> CreateAddressBookResponse
forall x.
CreateAddressBookResponse -> Rep CreateAddressBookResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAddressBookResponse x -> CreateAddressBookResponse
$cfrom :: forall x.
CreateAddressBookResponse -> Rep CreateAddressBookResponse x
Prelude.Generic)
newCreateAddressBookResponse ::
Prelude.Int ->
CreateAddressBookResponse
newCreateAddressBookResponse :: Int -> CreateAddressBookResponse
newCreateAddressBookResponse Int
pHttpStatus_ =
CreateAddressBookResponse' :: Maybe Text -> Int -> CreateAddressBookResponse
CreateAddressBookResponse'
{ $sel:addressBookArn:CreateAddressBookResponse' :: Maybe Text
addressBookArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateAddressBookResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createAddressBookResponse_addressBookArn :: Lens.Lens' CreateAddressBookResponse (Prelude.Maybe Prelude.Text)
createAddressBookResponse_addressBookArn :: (Maybe Text -> f (Maybe Text))
-> CreateAddressBookResponse -> f CreateAddressBookResponse
createAddressBookResponse_addressBookArn = (CreateAddressBookResponse -> Maybe Text)
-> (CreateAddressBookResponse
-> Maybe Text -> CreateAddressBookResponse)
-> Lens
CreateAddressBookResponse
CreateAddressBookResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressBookResponse' {Maybe Text
addressBookArn :: Maybe Text
$sel:addressBookArn:CreateAddressBookResponse' :: CreateAddressBookResponse -> Maybe Text
addressBookArn} -> Maybe Text
addressBookArn) (\s :: CreateAddressBookResponse
s@CreateAddressBookResponse' {} Maybe Text
a -> CreateAddressBookResponse
s {$sel:addressBookArn:CreateAddressBookResponse' :: Maybe Text
addressBookArn = Maybe Text
a} :: CreateAddressBookResponse)
createAddressBookResponse_httpStatus :: Lens.Lens' CreateAddressBookResponse Prelude.Int
createAddressBookResponse_httpStatus :: (Int -> f Int)
-> CreateAddressBookResponse -> f CreateAddressBookResponse
createAddressBookResponse_httpStatus = (CreateAddressBookResponse -> Int)
-> (CreateAddressBookResponse -> Int -> CreateAddressBookResponse)
-> Lens CreateAddressBookResponse CreateAddressBookResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressBookResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAddressBookResponse' :: CreateAddressBookResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAddressBookResponse
s@CreateAddressBookResponse' {} Int
a -> CreateAddressBookResponse
s {$sel:httpStatus:CreateAddressBookResponse' :: Int
httpStatus = Int
a} :: CreateAddressBookResponse)
instance Prelude.NFData CreateAddressBookResponse