{-# 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.Polly.PutLexicon
(
PutLexicon (..),
newPutLexicon,
putLexicon_name,
putLexicon_content,
PutLexiconResponse (..),
newPutLexiconResponse,
putLexiconResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Polly.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutLexicon = PutLexicon'
{
PutLexicon -> Text
name :: Prelude.Text,
PutLexicon -> Sensitive Text
content :: Data.Sensitive Prelude.Text
}
deriving (PutLexicon -> PutLexicon -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLexicon -> PutLexicon -> Bool
$c/= :: PutLexicon -> PutLexicon -> Bool
== :: PutLexicon -> PutLexicon -> Bool
$c== :: PutLexicon -> PutLexicon -> Bool
Prelude.Eq, Int -> PutLexicon -> ShowS
[PutLexicon] -> ShowS
PutLexicon -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLexicon] -> ShowS
$cshowList :: [PutLexicon] -> ShowS
show :: PutLexicon -> String
$cshow :: PutLexicon -> String
showsPrec :: Int -> PutLexicon -> ShowS
$cshowsPrec :: Int -> PutLexicon -> ShowS
Prelude.Show, forall x. Rep PutLexicon x -> PutLexicon
forall x. PutLexicon -> Rep PutLexicon x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutLexicon x -> PutLexicon
$cfrom :: forall x. PutLexicon -> Rep PutLexicon x
Prelude.Generic)
newPutLexicon ::
Prelude.Text ->
Prelude.Text ->
PutLexicon
newPutLexicon :: Text -> Text -> PutLexicon
newPutLexicon Text
pName_ Text
pContent_ =
PutLexicon'
{ $sel:name:PutLexicon' :: Text
name = Text
pName_,
$sel:content:PutLexicon' :: Sensitive Text
content = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pContent_
}
putLexicon_name :: Lens.Lens' PutLexicon Prelude.Text
putLexicon_name :: Lens' PutLexicon Text
putLexicon_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLexicon' {Text
name :: Text
$sel:name:PutLexicon' :: PutLexicon -> Text
name} -> Text
name) (\s :: PutLexicon
s@PutLexicon' {} Text
a -> PutLexicon
s {$sel:name:PutLexicon' :: Text
name = Text
a} :: PutLexicon)
putLexicon_content :: Lens.Lens' PutLexicon Prelude.Text
putLexicon_content :: Lens' PutLexicon Text
putLexicon_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLexicon' {Sensitive Text
content :: Sensitive Text
$sel:content:PutLexicon' :: PutLexicon -> Sensitive Text
content} -> Sensitive Text
content) (\s :: PutLexicon
s@PutLexicon' {} Sensitive Text
a -> PutLexicon
s {$sel:content:PutLexicon' :: Sensitive Text
content = Sensitive Text
a} :: PutLexicon) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Core.AWSRequest PutLexicon where
type AWSResponse PutLexicon = PutLexiconResponse
request :: (Service -> Service) -> PutLexicon -> Request PutLexicon
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutLexicon
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutLexicon)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutLexiconResponse
PutLexiconResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutLexicon where
hashWithSalt :: Int -> PutLexicon -> Int
hashWithSalt Int
_salt PutLexicon' {Text
Sensitive Text
content :: Sensitive Text
name :: Text
$sel:content:PutLexicon' :: PutLexicon -> Sensitive Text
$sel:name:PutLexicon' :: PutLexicon -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
content
instance Prelude.NFData PutLexicon where
rnf :: PutLexicon -> ()
rnf PutLexicon' {Text
Sensitive Text
content :: Sensitive Text
name :: Text
$sel:content:PutLexicon' :: PutLexicon -> Sensitive Text
$sel:name:PutLexicon' :: PutLexicon -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
content
instance Data.ToHeaders PutLexicon where
toHeaders :: PutLexicon -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON PutLexicon where
toJSON :: PutLexicon -> Value
toJSON PutLexicon' {Text
Sensitive Text
content :: Sensitive Text
name :: Text
$sel:content:PutLexicon' :: PutLexicon -> Sensitive Text
$sel:name:PutLexicon' :: PutLexicon -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Content" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
content)]
)
instance Data.ToPath PutLexicon where
toPath :: PutLexicon -> ByteString
toPath PutLexicon' {Text
Sensitive Text
content :: Sensitive Text
name :: Text
$sel:content:PutLexicon' :: PutLexicon -> Sensitive Text
$sel:name:PutLexicon' :: PutLexicon -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/v1/lexicons/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]
instance Data.ToQuery PutLexicon where
toQuery :: PutLexicon -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutLexiconResponse = PutLexiconResponse'
{
PutLexiconResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutLexiconResponse -> PutLexiconResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLexiconResponse -> PutLexiconResponse -> Bool
$c/= :: PutLexiconResponse -> PutLexiconResponse -> Bool
== :: PutLexiconResponse -> PutLexiconResponse -> Bool
$c== :: PutLexiconResponse -> PutLexiconResponse -> Bool
Prelude.Eq, ReadPrec [PutLexiconResponse]
ReadPrec PutLexiconResponse
Int -> ReadS PutLexiconResponse
ReadS [PutLexiconResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLexiconResponse]
$creadListPrec :: ReadPrec [PutLexiconResponse]
readPrec :: ReadPrec PutLexiconResponse
$creadPrec :: ReadPrec PutLexiconResponse
readList :: ReadS [PutLexiconResponse]
$creadList :: ReadS [PutLexiconResponse]
readsPrec :: Int -> ReadS PutLexiconResponse
$creadsPrec :: Int -> ReadS PutLexiconResponse
Prelude.Read, Int -> PutLexiconResponse -> ShowS
[PutLexiconResponse] -> ShowS
PutLexiconResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLexiconResponse] -> ShowS
$cshowList :: [PutLexiconResponse] -> ShowS
show :: PutLexiconResponse -> String
$cshow :: PutLexiconResponse -> String
showsPrec :: Int -> PutLexiconResponse -> ShowS
$cshowsPrec :: Int -> PutLexiconResponse -> ShowS
Prelude.Show, forall x. Rep PutLexiconResponse x -> PutLexiconResponse
forall x. PutLexiconResponse -> Rep PutLexiconResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutLexiconResponse x -> PutLexiconResponse
$cfrom :: forall x. PutLexiconResponse -> Rep PutLexiconResponse x
Prelude.Generic)
newPutLexiconResponse ::
Prelude.Int ->
PutLexiconResponse
newPutLexiconResponse :: Int -> PutLexiconResponse
newPutLexiconResponse Int
pHttpStatus_ =
PutLexiconResponse' {$sel:httpStatus:PutLexiconResponse' :: Int
httpStatus = Int
pHttpStatus_}
putLexiconResponse_httpStatus :: Lens.Lens' PutLexiconResponse Prelude.Int
putLexiconResponse_httpStatus :: Lens' PutLexiconResponse Int
putLexiconResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLexiconResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutLexiconResponse' :: PutLexiconResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutLexiconResponse
s@PutLexiconResponse' {} Int
a -> PutLexiconResponse
s {$sel:httpStatus:PutLexiconResponse' :: Int
httpStatus = Int
a} :: PutLexiconResponse)
instance Prelude.NFData PutLexiconResponse where
rnf :: PutLexiconResponse -> ()
rnf PutLexiconResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutLexiconResponse' :: PutLexiconResponse -> Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus