{-# 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.ImportTerminology
(
ImportTerminology (..),
newImportTerminology,
importTerminology_encryptionKey,
importTerminology_description,
importTerminology_name,
importTerminology_mergeStrategy,
importTerminology_terminologyData,
ImportTerminologyResponse (..),
newImportTerminologyResponse,
importTerminologyResponse_terminologyProperties,
importTerminologyResponse_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 ImportTerminology = ImportTerminology'
{
ImportTerminology -> Maybe EncryptionKey
encryptionKey :: Prelude.Maybe EncryptionKey,
ImportTerminology -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
ImportTerminology -> Text
name :: Prelude.Text,
ImportTerminology -> MergeStrategy
mergeStrategy :: MergeStrategy,
ImportTerminology -> TerminologyData
terminologyData :: TerminologyData
}
deriving (ImportTerminology -> ImportTerminology -> Bool
(ImportTerminology -> ImportTerminology -> Bool)
-> (ImportTerminology -> ImportTerminology -> Bool)
-> Eq ImportTerminology
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportTerminology -> ImportTerminology -> Bool
$c/= :: ImportTerminology -> ImportTerminology -> Bool
== :: ImportTerminology -> ImportTerminology -> Bool
$c== :: ImportTerminology -> ImportTerminology -> Bool
Prelude.Eq, Int -> ImportTerminology -> ShowS
[ImportTerminology] -> ShowS
ImportTerminology -> String
(Int -> ImportTerminology -> ShowS)
-> (ImportTerminology -> String)
-> ([ImportTerminology] -> ShowS)
-> Show ImportTerminology
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportTerminology] -> ShowS
$cshowList :: [ImportTerminology] -> ShowS
show :: ImportTerminology -> String
$cshow :: ImportTerminology -> String
showsPrec :: Int -> ImportTerminology -> ShowS
$cshowsPrec :: Int -> ImportTerminology -> ShowS
Prelude.Show, (forall x. ImportTerminology -> Rep ImportTerminology x)
-> (forall x. Rep ImportTerminology x -> ImportTerminology)
-> Generic ImportTerminology
forall x. Rep ImportTerminology x -> ImportTerminology
forall x. ImportTerminology -> Rep ImportTerminology x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportTerminology x -> ImportTerminology
$cfrom :: forall x. ImportTerminology -> Rep ImportTerminology x
Prelude.Generic)
newImportTerminology ::
Prelude.Text ->
MergeStrategy ->
TerminologyData ->
ImportTerminology
newImportTerminology :: Text -> MergeStrategy -> TerminologyData -> ImportTerminology
newImportTerminology
Text
pName_
MergeStrategy
pMergeStrategy_
TerminologyData
pTerminologyData_ =
ImportTerminology' :: Maybe EncryptionKey
-> Maybe Text
-> Text
-> MergeStrategy
-> TerminologyData
-> ImportTerminology
ImportTerminology'
{ $sel:encryptionKey:ImportTerminology' :: Maybe EncryptionKey
encryptionKey = Maybe EncryptionKey
forall a. Maybe a
Prelude.Nothing,
$sel:description:ImportTerminology' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:ImportTerminology' :: Text
name = Text
pName_,
$sel:mergeStrategy:ImportTerminology' :: MergeStrategy
mergeStrategy = MergeStrategy
pMergeStrategy_,
$sel:terminologyData:ImportTerminology' :: TerminologyData
terminologyData = TerminologyData
pTerminologyData_
}
importTerminology_encryptionKey :: Lens.Lens' ImportTerminology (Prelude.Maybe EncryptionKey)
importTerminology_encryptionKey :: (Maybe EncryptionKey -> f (Maybe EncryptionKey))
-> ImportTerminology -> f ImportTerminology
importTerminology_encryptionKey = (ImportTerminology -> Maybe EncryptionKey)
-> (ImportTerminology -> Maybe EncryptionKey -> ImportTerminology)
-> Lens
ImportTerminology
ImportTerminology
(Maybe EncryptionKey)
(Maybe EncryptionKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportTerminology' {Maybe EncryptionKey
encryptionKey :: Maybe EncryptionKey
$sel:encryptionKey:ImportTerminology' :: ImportTerminology -> Maybe EncryptionKey
encryptionKey} -> Maybe EncryptionKey
encryptionKey) (\s :: ImportTerminology
s@ImportTerminology' {} Maybe EncryptionKey
a -> ImportTerminology
s {$sel:encryptionKey:ImportTerminology' :: Maybe EncryptionKey
encryptionKey = Maybe EncryptionKey
a} :: ImportTerminology)
importTerminology_description :: Lens.Lens' ImportTerminology (Prelude.Maybe Prelude.Text)
importTerminology_description :: (Maybe Text -> f (Maybe Text))
-> ImportTerminology -> f ImportTerminology
importTerminology_description = (ImportTerminology -> Maybe Text)
-> (ImportTerminology -> Maybe Text -> ImportTerminology)
-> Lens
ImportTerminology ImportTerminology (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportTerminology' {Maybe Text
description :: Maybe Text
$sel:description:ImportTerminology' :: ImportTerminology -> Maybe Text
description} -> Maybe Text
description) (\s :: ImportTerminology
s@ImportTerminology' {} Maybe Text
a -> ImportTerminology
s {$sel:description:ImportTerminology' :: Maybe Text
description = Maybe Text
a} :: ImportTerminology)
importTerminology_name :: Lens.Lens' ImportTerminology Prelude.Text
importTerminology_name :: (Text -> f Text) -> ImportTerminology -> f ImportTerminology
importTerminology_name = (ImportTerminology -> Text)
-> (ImportTerminology -> Text -> ImportTerminology)
-> Lens ImportTerminology ImportTerminology Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportTerminology' {Text
name :: Text
$sel:name:ImportTerminology' :: ImportTerminology -> Text
name} -> Text
name) (\s :: ImportTerminology
s@ImportTerminology' {} Text
a -> ImportTerminology
s {$sel:name:ImportTerminology' :: Text
name = Text
a} :: ImportTerminology)
importTerminology_mergeStrategy :: Lens.Lens' ImportTerminology MergeStrategy
importTerminology_mergeStrategy :: (MergeStrategy -> f MergeStrategy)
-> ImportTerminology -> f ImportTerminology
importTerminology_mergeStrategy = (ImportTerminology -> MergeStrategy)
-> (ImportTerminology -> MergeStrategy -> ImportTerminology)
-> Lens
ImportTerminology ImportTerminology MergeStrategy MergeStrategy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportTerminology' {MergeStrategy
mergeStrategy :: MergeStrategy
$sel:mergeStrategy:ImportTerminology' :: ImportTerminology -> MergeStrategy
mergeStrategy} -> MergeStrategy
mergeStrategy) (\s :: ImportTerminology
s@ImportTerminology' {} MergeStrategy
a -> ImportTerminology
s {$sel:mergeStrategy:ImportTerminology' :: MergeStrategy
mergeStrategy = MergeStrategy
a} :: ImportTerminology)
importTerminology_terminologyData :: Lens.Lens' ImportTerminology TerminologyData
importTerminology_terminologyData :: (TerminologyData -> f TerminologyData)
-> ImportTerminology -> f ImportTerminology
importTerminology_terminologyData = (ImportTerminology -> TerminologyData)
-> (ImportTerminology -> TerminologyData -> ImportTerminology)
-> Lens
ImportTerminology ImportTerminology TerminologyData TerminologyData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportTerminology' {TerminologyData
terminologyData :: TerminologyData
$sel:terminologyData:ImportTerminology' :: ImportTerminology -> TerminologyData
terminologyData} -> TerminologyData
terminologyData) (\s :: ImportTerminology
s@ImportTerminology' {} TerminologyData
a -> ImportTerminology
s {$sel:terminologyData:ImportTerminology' :: TerminologyData
terminologyData = TerminologyData
a} :: ImportTerminology)
instance Core.AWSRequest ImportTerminology where
type
AWSResponse ImportTerminology =
ImportTerminologyResponse
request :: ImportTerminology -> Request ImportTerminology
request = Service -> ImportTerminology -> Request ImportTerminology
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ImportTerminology
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportTerminology)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ImportTerminology))
-> Logger
-> Service
-> Proxy ImportTerminology
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportTerminology)))
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 -> Int -> ImportTerminologyResponse
ImportTerminologyResponse'
(Maybe TerminologyProperties -> Int -> ImportTerminologyResponse)
-> Either String (Maybe TerminologyProperties)
-> Either String (Int -> ImportTerminologyResponse)
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 (Int -> ImportTerminologyResponse)
-> Either String Int -> Either String ImportTerminologyResponse
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 ImportTerminology
instance Prelude.NFData ImportTerminology
instance Core.ToHeaders ImportTerminology where
toHeaders :: ImportTerminology -> ResponseHeaders
toHeaders =
ResponseHeaders -> ImportTerminology -> 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.ImportTerminology" ::
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 ImportTerminology where
toJSON :: ImportTerminology -> Value
toJSON ImportTerminology' {Maybe Text
Maybe EncryptionKey
Text
MergeStrategy
TerminologyData
terminologyData :: TerminologyData
mergeStrategy :: MergeStrategy
name :: Text
description :: Maybe Text
encryptionKey :: Maybe EncryptionKey
$sel:terminologyData:ImportTerminology' :: ImportTerminology -> TerminologyData
$sel:mergeStrategy:ImportTerminology' :: ImportTerminology -> MergeStrategy
$sel:name:ImportTerminology' :: ImportTerminology -> Text
$sel:description:ImportTerminology' :: ImportTerminology -> Maybe Text
$sel:encryptionKey:ImportTerminology' :: ImportTerminology -> Maybe EncryptionKey
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EncryptionKey" Text -> EncryptionKey -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EncryptionKey -> Pair) -> Maybe EncryptionKey -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionKey
encryptionKey,
(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,
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
"MergeStrategy" Text -> MergeStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MergeStrategy
mergeStrategy),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TerminologyData" Text -> TerminologyData -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TerminologyData
terminologyData)
]
)
instance Core.ToPath ImportTerminology where
toPath :: ImportTerminology -> ByteString
toPath = ByteString -> ImportTerminology -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ImportTerminology where
toQuery :: ImportTerminology -> QueryString
toQuery = QueryString -> ImportTerminology -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ImportTerminologyResponse = ImportTerminologyResponse'
{
ImportTerminologyResponse -> Maybe TerminologyProperties
terminologyProperties :: Prelude.Maybe TerminologyProperties,
ImportTerminologyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ImportTerminologyResponse -> ImportTerminologyResponse -> Bool
(ImportTerminologyResponse -> ImportTerminologyResponse -> Bool)
-> (ImportTerminologyResponse -> ImportTerminologyResponse -> Bool)
-> Eq ImportTerminologyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportTerminologyResponse -> ImportTerminologyResponse -> Bool
$c/= :: ImportTerminologyResponse -> ImportTerminologyResponse -> Bool
== :: ImportTerminologyResponse -> ImportTerminologyResponse -> Bool
$c== :: ImportTerminologyResponse -> ImportTerminologyResponse -> Bool
Prelude.Eq, ReadPrec [ImportTerminologyResponse]
ReadPrec ImportTerminologyResponse
Int -> ReadS ImportTerminologyResponse
ReadS [ImportTerminologyResponse]
(Int -> ReadS ImportTerminologyResponse)
-> ReadS [ImportTerminologyResponse]
-> ReadPrec ImportTerminologyResponse
-> ReadPrec [ImportTerminologyResponse]
-> Read ImportTerminologyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportTerminologyResponse]
$creadListPrec :: ReadPrec [ImportTerminologyResponse]
readPrec :: ReadPrec ImportTerminologyResponse
$creadPrec :: ReadPrec ImportTerminologyResponse
readList :: ReadS [ImportTerminologyResponse]
$creadList :: ReadS [ImportTerminologyResponse]
readsPrec :: Int -> ReadS ImportTerminologyResponse
$creadsPrec :: Int -> ReadS ImportTerminologyResponse
Prelude.Read, Int -> ImportTerminologyResponse -> ShowS
[ImportTerminologyResponse] -> ShowS
ImportTerminologyResponse -> String
(Int -> ImportTerminologyResponse -> ShowS)
-> (ImportTerminologyResponse -> String)
-> ([ImportTerminologyResponse] -> ShowS)
-> Show ImportTerminologyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportTerminologyResponse] -> ShowS
$cshowList :: [ImportTerminologyResponse] -> ShowS
show :: ImportTerminologyResponse -> String
$cshow :: ImportTerminologyResponse -> String
showsPrec :: Int -> ImportTerminologyResponse -> ShowS
$cshowsPrec :: Int -> ImportTerminologyResponse -> ShowS
Prelude.Show, (forall x.
ImportTerminologyResponse -> Rep ImportTerminologyResponse x)
-> (forall x.
Rep ImportTerminologyResponse x -> ImportTerminologyResponse)
-> Generic ImportTerminologyResponse
forall x.
Rep ImportTerminologyResponse x -> ImportTerminologyResponse
forall x.
ImportTerminologyResponse -> Rep ImportTerminologyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ImportTerminologyResponse x -> ImportTerminologyResponse
$cfrom :: forall x.
ImportTerminologyResponse -> Rep ImportTerminologyResponse x
Prelude.Generic)
newImportTerminologyResponse ::
Prelude.Int ->
ImportTerminologyResponse
newImportTerminologyResponse :: Int -> ImportTerminologyResponse
newImportTerminologyResponse Int
pHttpStatus_ =
ImportTerminologyResponse' :: Maybe TerminologyProperties -> Int -> ImportTerminologyResponse
ImportTerminologyResponse'
{ $sel:terminologyProperties:ImportTerminologyResponse' :: Maybe TerminologyProperties
terminologyProperties =
Maybe TerminologyProperties
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ImportTerminologyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
importTerminologyResponse_terminologyProperties :: Lens.Lens' ImportTerminologyResponse (Prelude.Maybe TerminologyProperties)
importTerminologyResponse_terminologyProperties :: (Maybe TerminologyProperties -> f (Maybe TerminologyProperties))
-> ImportTerminologyResponse -> f ImportTerminologyResponse
importTerminologyResponse_terminologyProperties = (ImportTerminologyResponse -> Maybe TerminologyProperties)
-> (ImportTerminologyResponse
-> Maybe TerminologyProperties -> ImportTerminologyResponse)
-> Lens
ImportTerminologyResponse
ImportTerminologyResponse
(Maybe TerminologyProperties)
(Maybe TerminologyProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportTerminologyResponse' {Maybe TerminologyProperties
terminologyProperties :: Maybe TerminologyProperties
$sel:terminologyProperties:ImportTerminologyResponse' :: ImportTerminologyResponse -> Maybe TerminologyProperties
terminologyProperties} -> Maybe TerminologyProperties
terminologyProperties) (\s :: ImportTerminologyResponse
s@ImportTerminologyResponse' {} Maybe TerminologyProperties
a -> ImportTerminologyResponse
s {$sel:terminologyProperties:ImportTerminologyResponse' :: Maybe TerminologyProperties
terminologyProperties = Maybe TerminologyProperties
a} :: ImportTerminologyResponse)
importTerminologyResponse_httpStatus :: Lens.Lens' ImportTerminologyResponse Prelude.Int
importTerminologyResponse_httpStatus :: (Int -> f Int)
-> ImportTerminologyResponse -> f ImportTerminologyResponse
importTerminologyResponse_httpStatus = (ImportTerminologyResponse -> Int)
-> (ImportTerminologyResponse -> Int -> ImportTerminologyResponse)
-> Lens ImportTerminologyResponse ImportTerminologyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportTerminologyResponse' {Int
httpStatus :: Int
$sel:httpStatus:ImportTerminologyResponse' :: ImportTerminologyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ImportTerminologyResponse
s@ImportTerminologyResponse' {} Int
a -> ImportTerminologyResponse
s {$sel:httpStatus:ImportTerminologyResponse' :: Int
httpStatus = Int
a} :: ImportTerminologyResponse)
instance Prelude.NFData ImportTerminologyResponse