{-# 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.Translate.GetTerminology
(
GetTerminology (..),
newGetTerminology,
getTerminology_name,
getTerminology_terminologyDataFormat,
GetTerminologyResponse (..),
newGetTerminologyResponse,
getTerminologyResponse_terminologyProperties,
getTerminologyResponse_terminologyDataLocation,
getTerminologyResponse_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.Translate.Types
data GetTerminology = GetTerminology'
{
GetTerminology -> Text
name :: Prelude.Text,
GetTerminology -> TerminologyDataFormat
terminologyDataFormat :: TerminologyDataFormat
}
deriving (GetTerminology -> GetTerminology -> Bool
(GetTerminology -> GetTerminology -> Bool)
-> (GetTerminology -> GetTerminology -> Bool) -> Eq GetTerminology
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTerminology -> GetTerminology -> Bool
$c/= :: GetTerminology -> GetTerminology -> Bool
== :: GetTerminology -> GetTerminology -> Bool
$c== :: GetTerminology -> GetTerminology -> Bool
Prelude.Eq, ReadPrec [GetTerminology]
ReadPrec GetTerminology
Int -> ReadS GetTerminology
ReadS [GetTerminology]
(Int -> ReadS GetTerminology)
-> ReadS [GetTerminology]
-> ReadPrec GetTerminology
-> ReadPrec [GetTerminology]
-> Read GetTerminology
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTerminology]
$creadListPrec :: ReadPrec [GetTerminology]
readPrec :: ReadPrec GetTerminology
$creadPrec :: ReadPrec GetTerminology
readList :: ReadS [GetTerminology]
$creadList :: ReadS [GetTerminology]
readsPrec :: Int -> ReadS GetTerminology
$creadsPrec :: Int -> ReadS GetTerminology
Prelude.Read, Int -> GetTerminology -> ShowS
[GetTerminology] -> ShowS
GetTerminology -> String
(Int -> GetTerminology -> ShowS)
-> (GetTerminology -> String)
-> ([GetTerminology] -> ShowS)
-> Show GetTerminology
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTerminology] -> ShowS
$cshowList :: [GetTerminology] -> ShowS
show :: GetTerminology -> String
$cshow :: GetTerminology -> String
showsPrec :: Int -> GetTerminology -> ShowS
$cshowsPrec :: Int -> GetTerminology -> ShowS
Prelude.Show, (forall x. GetTerminology -> Rep GetTerminology x)
-> (forall x. Rep GetTerminology x -> GetTerminology)
-> Generic GetTerminology
forall x. Rep GetTerminology x -> GetTerminology
forall x. GetTerminology -> Rep GetTerminology x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTerminology x -> GetTerminology
$cfrom :: forall x. GetTerminology -> Rep GetTerminology x
Prelude.Generic)
newGetTerminology ::
Prelude.Text ->
TerminologyDataFormat ->
GetTerminology
newGetTerminology :: Text -> TerminologyDataFormat -> GetTerminology
newGetTerminology Text
pName_ TerminologyDataFormat
pTerminologyDataFormat_ =
GetTerminology' :: Text -> TerminologyDataFormat -> GetTerminology
GetTerminology'
{ $sel:name:GetTerminology' :: Text
name = Text
pName_,
$sel:terminologyDataFormat:GetTerminology' :: TerminologyDataFormat
terminologyDataFormat = TerminologyDataFormat
pTerminologyDataFormat_
}
getTerminology_name :: Lens.Lens' GetTerminology Prelude.Text
getTerminology_name :: (Text -> f Text) -> GetTerminology -> f GetTerminology
getTerminology_name = (GetTerminology -> Text)
-> (GetTerminology -> Text -> GetTerminology)
-> Lens GetTerminology GetTerminology Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTerminology' {Text
name :: Text
$sel:name:GetTerminology' :: GetTerminology -> Text
name} -> Text
name) (\s :: GetTerminology
s@GetTerminology' {} Text
a -> GetTerminology
s {$sel:name:GetTerminology' :: Text
name = Text
a} :: GetTerminology)
getTerminology_terminologyDataFormat :: Lens.Lens' GetTerminology TerminologyDataFormat
getTerminology_terminologyDataFormat :: (TerminologyDataFormat -> f TerminologyDataFormat)
-> GetTerminology -> f GetTerminology
getTerminology_terminologyDataFormat = (GetTerminology -> TerminologyDataFormat)
-> (GetTerminology -> TerminologyDataFormat -> GetTerminology)
-> Lens
GetTerminology
GetTerminology
TerminologyDataFormat
TerminologyDataFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTerminology' {TerminologyDataFormat
terminologyDataFormat :: TerminologyDataFormat
$sel:terminologyDataFormat:GetTerminology' :: GetTerminology -> TerminologyDataFormat
terminologyDataFormat} -> TerminologyDataFormat
terminologyDataFormat) (\s :: GetTerminology
s@GetTerminology' {} TerminologyDataFormat
a -> GetTerminology
s {$sel:terminologyDataFormat:GetTerminology' :: TerminologyDataFormat
terminologyDataFormat = TerminologyDataFormat
a} :: GetTerminology)
instance Core.AWSRequest GetTerminology where
type
AWSResponse GetTerminology =
GetTerminologyResponse
request :: GetTerminology -> Request GetTerminology
request = Service -> GetTerminology -> Request GetTerminology
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetTerminology
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTerminology)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetTerminology))
-> Logger
-> Service
-> Proxy GetTerminology
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTerminology)))
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 TerminologyProperties
-> Maybe TerminologyDataLocation -> Int -> GetTerminologyResponse
GetTerminologyResponse'
(Maybe TerminologyProperties
-> Maybe TerminologyDataLocation -> Int -> GetTerminologyResponse)
-> Either String (Maybe TerminologyProperties)
-> Either
String
(Maybe TerminologyDataLocation -> Int -> GetTerminologyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TerminologyProperties)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TerminologyProperties")
Either
String
(Maybe TerminologyDataLocation -> Int -> GetTerminologyResponse)
-> Either String (Maybe TerminologyDataLocation)
-> Either String (Int -> GetTerminologyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe TerminologyDataLocation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TerminologyDataLocation")
Either String (Int -> GetTerminologyResponse)
-> Either String Int -> Either String GetTerminologyResponse
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 GetTerminology
instance Prelude.NFData GetTerminology
instance Core.ToHeaders GetTerminology where
toHeaders :: GetTerminology -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetTerminology -> 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
"AWSShineFrontendService_20170701.GetTerminology" ::
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 GetTerminology where
toJSON :: GetTerminology -> Value
toJSON GetTerminology' {Text
TerminologyDataFormat
terminologyDataFormat :: TerminologyDataFormat
name :: Text
$sel:terminologyDataFormat:GetTerminology' :: GetTerminology -> TerminologyDataFormat
$sel:name:GetTerminology' :: GetTerminology -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"TerminologyDataFormat"
Text -> TerminologyDataFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TerminologyDataFormat
terminologyDataFormat
)
]
)
instance Core.ToPath GetTerminology where
toPath :: GetTerminology -> ByteString
toPath = ByteString -> GetTerminology -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetTerminology where
toQuery :: GetTerminology -> QueryString
toQuery = QueryString -> GetTerminology -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetTerminologyResponse = GetTerminologyResponse'
{
GetTerminologyResponse -> Maybe TerminologyProperties
terminologyProperties :: Prelude.Maybe TerminologyProperties,
GetTerminologyResponse -> Maybe TerminologyDataLocation
terminologyDataLocation :: Prelude.Maybe TerminologyDataLocation,
GetTerminologyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTerminologyResponse -> GetTerminologyResponse -> Bool
(GetTerminologyResponse -> GetTerminologyResponse -> Bool)
-> (GetTerminologyResponse -> GetTerminologyResponse -> Bool)
-> Eq GetTerminologyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTerminologyResponse -> GetTerminologyResponse -> Bool
$c/= :: GetTerminologyResponse -> GetTerminologyResponse -> Bool
== :: GetTerminologyResponse -> GetTerminologyResponse -> Bool
$c== :: GetTerminologyResponse -> GetTerminologyResponse -> Bool
Prelude.Eq, ReadPrec [GetTerminologyResponse]
ReadPrec GetTerminologyResponse
Int -> ReadS GetTerminologyResponse
ReadS [GetTerminologyResponse]
(Int -> ReadS GetTerminologyResponse)
-> ReadS [GetTerminologyResponse]
-> ReadPrec GetTerminologyResponse
-> ReadPrec [GetTerminologyResponse]
-> Read GetTerminologyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTerminologyResponse]
$creadListPrec :: ReadPrec [GetTerminologyResponse]
readPrec :: ReadPrec GetTerminologyResponse
$creadPrec :: ReadPrec GetTerminologyResponse
readList :: ReadS [GetTerminologyResponse]
$creadList :: ReadS [GetTerminologyResponse]
readsPrec :: Int -> ReadS GetTerminologyResponse
$creadsPrec :: Int -> ReadS GetTerminologyResponse
Prelude.Read, Int -> GetTerminologyResponse -> ShowS
[GetTerminologyResponse] -> ShowS
GetTerminologyResponse -> String
(Int -> GetTerminologyResponse -> ShowS)
-> (GetTerminologyResponse -> String)
-> ([GetTerminologyResponse] -> ShowS)
-> Show GetTerminologyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTerminologyResponse] -> ShowS
$cshowList :: [GetTerminologyResponse] -> ShowS
show :: GetTerminologyResponse -> String
$cshow :: GetTerminologyResponse -> String
showsPrec :: Int -> GetTerminologyResponse -> ShowS
$cshowsPrec :: Int -> GetTerminologyResponse -> ShowS
Prelude.Show, (forall x. GetTerminologyResponse -> Rep GetTerminologyResponse x)
-> (forall x.
Rep GetTerminologyResponse x -> GetTerminologyResponse)
-> Generic GetTerminologyResponse
forall x. Rep GetTerminologyResponse x -> GetTerminologyResponse
forall x. GetTerminologyResponse -> Rep GetTerminologyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTerminologyResponse x -> GetTerminologyResponse
$cfrom :: forall x. GetTerminologyResponse -> Rep GetTerminologyResponse x
Prelude.Generic)
newGetTerminologyResponse ::
Prelude.Int ->
GetTerminologyResponse
newGetTerminologyResponse :: Int -> GetTerminologyResponse
newGetTerminologyResponse Int
pHttpStatus_ =
GetTerminologyResponse' :: Maybe TerminologyProperties
-> Maybe TerminologyDataLocation -> Int -> GetTerminologyResponse
GetTerminologyResponse'
{ $sel:terminologyProperties:GetTerminologyResponse' :: Maybe TerminologyProperties
terminologyProperties =
Maybe TerminologyProperties
forall a. Maybe a
Prelude.Nothing,
$sel:terminologyDataLocation:GetTerminologyResponse' :: Maybe TerminologyDataLocation
terminologyDataLocation = Maybe TerminologyDataLocation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTerminologyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTerminologyResponse_terminologyProperties :: Lens.Lens' GetTerminologyResponse (Prelude.Maybe TerminologyProperties)
getTerminologyResponse_terminologyProperties :: (Maybe TerminologyProperties -> f (Maybe TerminologyProperties))
-> GetTerminologyResponse -> f GetTerminologyResponse
getTerminologyResponse_terminologyProperties = (GetTerminologyResponse -> Maybe TerminologyProperties)
-> (GetTerminologyResponse
-> Maybe TerminologyProperties -> GetTerminologyResponse)
-> Lens
GetTerminologyResponse
GetTerminologyResponse
(Maybe TerminologyProperties)
(Maybe TerminologyProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTerminologyResponse' {Maybe TerminologyProperties
terminologyProperties :: Maybe TerminologyProperties
$sel:terminologyProperties:GetTerminologyResponse' :: GetTerminologyResponse -> Maybe TerminologyProperties
terminologyProperties} -> Maybe TerminologyProperties
terminologyProperties) (\s :: GetTerminologyResponse
s@GetTerminologyResponse' {} Maybe TerminologyProperties
a -> GetTerminologyResponse
s {$sel:terminologyProperties:GetTerminologyResponse' :: Maybe TerminologyProperties
terminologyProperties = Maybe TerminologyProperties
a} :: GetTerminologyResponse)
getTerminologyResponse_terminologyDataLocation :: Lens.Lens' GetTerminologyResponse (Prelude.Maybe TerminologyDataLocation)
getTerminologyResponse_terminologyDataLocation :: (Maybe TerminologyDataLocation
-> f (Maybe TerminologyDataLocation))
-> GetTerminologyResponse -> f GetTerminologyResponse
getTerminologyResponse_terminologyDataLocation = (GetTerminologyResponse -> Maybe TerminologyDataLocation)
-> (GetTerminologyResponse
-> Maybe TerminologyDataLocation -> GetTerminologyResponse)
-> Lens
GetTerminologyResponse
GetTerminologyResponse
(Maybe TerminologyDataLocation)
(Maybe TerminologyDataLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTerminologyResponse' {Maybe TerminologyDataLocation
terminologyDataLocation :: Maybe TerminologyDataLocation
$sel:terminologyDataLocation:GetTerminologyResponse' :: GetTerminologyResponse -> Maybe TerminologyDataLocation
terminologyDataLocation} -> Maybe TerminologyDataLocation
terminologyDataLocation) (\s :: GetTerminologyResponse
s@GetTerminologyResponse' {} Maybe TerminologyDataLocation
a -> GetTerminologyResponse
s {$sel:terminologyDataLocation:GetTerminologyResponse' :: Maybe TerminologyDataLocation
terminologyDataLocation = Maybe TerminologyDataLocation
a} :: GetTerminologyResponse)
getTerminologyResponse_httpStatus :: Lens.Lens' GetTerminologyResponse Prelude.Int
getTerminologyResponse_httpStatus :: (Int -> f Int)
-> GetTerminologyResponse -> f GetTerminologyResponse
getTerminologyResponse_httpStatus = (GetTerminologyResponse -> Int)
-> (GetTerminologyResponse -> Int -> GetTerminologyResponse)
-> Lens GetTerminologyResponse GetTerminologyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTerminologyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTerminologyResponse' :: GetTerminologyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTerminologyResponse
s@GetTerminologyResponse' {} Int
a -> GetTerminologyResponse
s {$sel:httpStatus:GetTerminologyResponse' :: Int
httpStatus = Int
a} :: GetTerminologyResponse)
instance Prelude.NFData GetTerminologyResponse