{-# 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.GetLexicon
(
GetLexicon (..),
newGetLexicon,
getLexicon_name,
GetLexiconResponse (..),
newGetLexiconResponse,
getLexiconResponse_lexicon,
getLexiconResponse_lexiconAttributes,
getLexiconResponse_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 GetLexicon = GetLexicon'
{
GetLexicon -> Text
name :: Prelude.Text
}
deriving (GetLexicon -> GetLexicon -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLexicon -> GetLexicon -> Bool
$c/= :: GetLexicon -> GetLexicon -> Bool
== :: GetLexicon -> GetLexicon -> Bool
$c== :: GetLexicon -> GetLexicon -> Bool
Prelude.Eq, ReadPrec [GetLexicon]
ReadPrec GetLexicon
Int -> ReadS GetLexicon
ReadS [GetLexicon]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLexicon]
$creadListPrec :: ReadPrec [GetLexicon]
readPrec :: ReadPrec GetLexicon
$creadPrec :: ReadPrec GetLexicon
readList :: ReadS [GetLexicon]
$creadList :: ReadS [GetLexicon]
readsPrec :: Int -> ReadS GetLexicon
$creadsPrec :: Int -> ReadS GetLexicon
Prelude.Read, Int -> GetLexicon -> ShowS
[GetLexicon] -> ShowS
GetLexicon -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLexicon] -> ShowS
$cshowList :: [GetLexicon] -> ShowS
show :: GetLexicon -> String
$cshow :: GetLexicon -> String
showsPrec :: Int -> GetLexicon -> ShowS
$cshowsPrec :: Int -> GetLexicon -> ShowS
Prelude.Show, forall x. Rep GetLexicon x -> GetLexicon
forall x. GetLexicon -> Rep GetLexicon x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLexicon x -> GetLexicon
$cfrom :: forall x. GetLexicon -> Rep GetLexicon x
Prelude.Generic)
newGetLexicon ::
Prelude.Text ->
GetLexicon
newGetLexicon :: Text -> GetLexicon
newGetLexicon Text
pName_ = GetLexicon' {$sel:name:GetLexicon' :: Text
name = Text
pName_}
getLexicon_name :: Lens.Lens' GetLexicon Prelude.Text
getLexicon_name :: Lens' GetLexicon Text
getLexicon_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLexicon' {Text
name :: Text
$sel:name:GetLexicon' :: GetLexicon -> Text
name} -> Text
name) (\s :: GetLexicon
s@GetLexicon' {} Text
a -> GetLexicon
s {$sel:name:GetLexicon' :: Text
name = Text
a} :: GetLexicon)
instance Core.AWSRequest GetLexicon where
type AWSResponse GetLexicon = GetLexiconResponse
request :: (Service -> Service) -> GetLexicon -> Request GetLexicon
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetLexicon
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetLexicon)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Lexicon
-> Maybe LexiconAttributes -> Int -> GetLexiconResponse
GetLexiconResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Lexicon")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LexiconAttributes")
forall (f :: * -> *) a b. Applicative f => 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 GetLexicon where
hashWithSalt :: Int -> GetLexicon -> Int
hashWithSalt Int
_salt GetLexicon' {Text
name :: Text
$sel:name:GetLexicon' :: GetLexicon -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData GetLexicon where
rnf :: GetLexicon -> ()
rnf GetLexicon' {Text
name :: Text
$sel:name:GetLexicon' :: GetLexicon -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders GetLexicon where
toHeaders :: GetLexicon -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetLexicon where
toPath :: GetLexicon -> ByteString
toPath GetLexicon' {Text
name :: Text
$sel:name:GetLexicon' :: GetLexicon -> 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 GetLexicon where
toQuery :: GetLexicon -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetLexiconResponse = GetLexiconResponse'
{
GetLexiconResponse -> Maybe Lexicon
lexicon :: Prelude.Maybe Lexicon,
GetLexiconResponse -> Maybe LexiconAttributes
lexiconAttributes :: Prelude.Maybe LexiconAttributes,
GetLexiconResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetLexiconResponse -> GetLexiconResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLexiconResponse -> GetLexiconResponse -> Bool
$c/= :: GetLexiconResponse -> GetLexiconResponse -> Bool
== :: GetLexiconResponse -> GetLexiconResponse -> Bool
$c== :: GetLexiconResponse -> GetLexiconResponse -> Bool
Prelude.Eq, Int -> GetLexiconResponse -> ShowS
[GetLexiconResponse] -> ShowS
GetLexiconResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLexiconResponse] -> ShowS
$cshowList :: [GetLexiconResponse] -> ShowS
show :: GetLexiconResponse -> String
$cshow :: GetLexiconResponse -> String
showsPrec :: Int -> GetLexiconResponse -> ShowS
$cshowsPrec :: Int -> GetLexiconResponse -> ShowS
Prelude.Show, forall x. Rep GetLexiconResponse x -> GetLexiconResponse
forall x. GetLexiconResponse -> Rep GetLexiconResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLexiconResponse x -> GetLexiconResponse
$cfrom :: forall x. GetLexiconResponse -> Rep GetLexiconResponse x
Prelude.Generic)
newGetLexiconResponse ::
Prelude.Int ->
GetLexiconResponse
newGetLexiconResponse :: Int -> GetLexiconResponse
newGetLexiconResponse Int
pHttpStatus_ =
GetLexiconResponse'
{ $sel:lexicon:GetLexiconResponse' :: Maybe Lexicon
lexicon = forall a. Maybe a
Prelude.Nothing,
$sel:lexiconAttributes:GetLexiconResponse' :: Maybe LexiconAttributes
lexiconAttributes = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetLexiconResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getLexiconResponse_lexicon :: Lens.Lens' GetLexiconResponse (Prelude.Maybe Lexicon)
getLexiconResponse_lexicon :: Lens' GetLexiconResponse (Maybe Lexicon)
getLexiconResponse_lexicon = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLexiconResponse' {Maybe Lexicon
lexicon :: Maybe Lexicon
$sel:lexicon:GetLexiconResponse' :: GetLexiconResponse -> Maybe Lexicon
lexicon} -> Maybe Lexicon
lexicon) (\s :: GetLexiconResponse
s@GetLexiconResponse' {} Maybe Lexicon
a -> GetLexiconResponse
s {$sel:lexicon:GetLexiconResponse' :: Maybe Lexicon
lexicon = Maybe Lexicon
a} :: GetLexiconResponse)
getLexiconResponse_lexiconAttributes :: Lens.Lens' GetLexiconResponse (Prelude.Maybe LexiconAttributes)
getLexiconResponse_lexiconAttributes :: Lens' GetLexiconResponse (Maybe LexiconAttributes)
getLexiconResponse_lexiconAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLexiconResponse' {Maybe LexiconAttributes
lexiconAttributes :: Maybe LexiconAttributes
$sel:lexiconAttributes:GetLexiconResponse' :: GetLexiconResponse -> Maybe LexiconAttributes
lexiconAttributes} -> Maybe LexiconAttributes
lexiconAttributes) (\s :: GetLexiconResponse
s@GetLexiconResponse' {} Maybe LexiconAttributes
a -> GetLexiconResponse
s {$sel:lexiconAttributes:GetLexiconResponse' :: Maybe LexiconAttributes
lexiconAttributes = Maybe LexiconAttributes
a} :: GetLexiconResponse)
getLexiconResponse_httpStatus :: Lens.Lens' GetLexiconResponse Prelude.Int
getLexiconResponse_httpStatus :: Lens' GetLexiconResponse Int
getLexiconResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLexiconResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetLexiconResponse' :: GetLexiconResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetLexiconResponse
s@GetLexiconResponse' {} Int
a -> GetLexiconResponse
s {$sel:httpStatus:GetLexiconResponse' :: Int
httpStatus = Int
a} :: GetLexiconResponse)
instance Prelude.NFData GetLexiconResponse where
rnf :: GetLexiconResponse -> ()
rnf GetLexiconResponse' {Int
Maybe Lexicon
Maybe LexiconAttributes
httpStatus :: Int
lexiconAttributes :: Maybe LexiconAttributes
lexicon :: Maybe Lexicon
$sel:httpStatus:GetLexiconResponse' :: GetLexiconResponse -> Int
$sel:lexiconAttributes:GetLexiconResponse' :: GetLexiconResponse -> Maybe LexiconAttributes
$sel:lexicon:GetLexiconResponse' :: GetLexiconResponse -> Maybe Lexicon
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Lexicon
lexicon
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LexiconAttributes
lexiconAttributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus