{-# 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.CloudSearch.DefineIndexField
(
DefineIndexField (..),
newDefineIndexField,
defineIndexField_domainName,
defineIndexField_indexField,
DefineIndexFieldResponse (..),
newDefineIndexFieldResponse,
defineIndexFieldResponse_httpStatus,
defineIndexFieldResponse_indexField,
)
where
import Amazonka.CloudSearch.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 DefineIndexField = DefineIndexField'
{ DefineIndexField -> Text
domainName :: Prelude.Text,
DefineIndexField -> IndexField
indexField :: IndexField
}
deriving (DefineIndexField -> DefineIndexField -> Bool
(DefineIndexField -> DefineIndexField -> Bool)
-> (DefineIndexField -> DefineIndexField -> Bool)
-> Eq DefineIndexField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefineIndexField -> DefineIndexField -> Bool
$c/= :: DefineIndexField -> DefineIndexField -> Bool
== :: DefineIndexField -> DefineIndexField -> Bool
$c== :: DefineIndexField -> DefineIndexField -> Bool
Prelude.Eq, ReadPrec [DefineIndexField]
ReadPrec DefineIndexField
Int -> ReadS DefineIndexField
ReadS [DefineIndexField]
(Int -> ReadS DefineIndexField)
-> ReadS [DefineIndexField]
-> ReadPrec DefineIndexField
-> ReadPrec [DefineIndexField]
-> Read DefineIndexField
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefineIndexField]
$creadListPrec :: ReadPrec [DefineIndexField]
readPrec :: ReadPrec DefineIndexField
$creadPrec :: ReadPrec DefineIndexField
readList :: ReadS [DefineIndexField]
$creadList :: ReadS [DefineIndexField]
readsPrec :: Int -> ReadS DefineIndexField
$creadsPrec :: Int -> ReadS DefineIndexField
Prelude.Read, Int -> DefineIndexField -> ShowS
[DefineIndexField] -> ShowS
DefineIndexField -> String
(Int -> DefineIndexField -> ShowS)
-> (DefineIndexField -> String)
-> ([DefineIndexField] -> ShowS)
-> Show DefineIndexField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefineIndexField] -> ShowS
$cshowList :: [DefineIndexField] -> ShowS
show :: DefineIndexField -> String
$cshow :: DefineIndexField -> String
showsPrec :: Int -> DefineIndexField -> ShowS
$cshowsPrec :: Int -> DefineIndexField -> ShowS
Prelude.Show, (forall x. DefineIndexField -> Rep DefineIndexField x)
-> (forall x. Rep DefineIndexField x -> DefineIndexField)
-> Generic DefineIndexField
forall x. Rep DefineIndexField x -> DefineIndexField
forall x. DefineIndexField -> Rep DefineIndexField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DefineIndexField x -> DefineIndexField
$cfrom :: forall x. DefineIndexField -> Rep DefineIndexField x
Prelude.Generic)
newDefineIndexField ::
Prelude.Text ->
IndexField ->
DefineIndexField
newDefineIndexField :: Text -> IndexField -> DefineIndexField
newDefineIndexField Text
pDomainName_ IndexField
pIndexField_ =
DefineIndexField' :: Text -> IndexField -> DefineIndexField
DefineIndexField'
{ $sel:domainName:DefineIndexField' :: Text
domainName = Text
pDomainName_,
$sel:indexField:DefineIndexField' :: IndexField
indexField = IndexField
pIndexField_
}
defineIndexField_domainName :: Lens.Lens' DefineIndexField Prelude.Text
defineIndexField_domainName :: (Text -> f Text) -> DefineIndexField -> f DefineIndexField
defineIndexField_domainName = (DefineIndexField -> Text)
-> (DefineIndexField -> Text -> DefineIndexField)
-> Lens DefineIndexField DefineIndexField Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineIndexField' {Text
domainName :: Text
$sel:domainName:DefineIndexField' :: DefineIndexField -> Text
domainName} -> Text
domainName) (\s :: DefineIndexField
s@DefineIndexField' {} Text
a -> DefineIndexField
s {$sel:domainName:DefineIndexField' :: Text
domainName = Text
a} :: DefineIndexField)
defineIndexField_indexField :: Lens.Lens' DefineIndexField IndexField
defineIndexField_indexField :: (IndexField -> f IndexField)
-> DefineIndexField -> f DefineIndexField
defineIndexField_indexField = (DefineIndexField -> IndexField)
-> (DefineIndexField -> IndexField -> DefineIndexField)
-> Lens DefineIndexField DefineIndexField IndexField IndexField
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineIndexField' {IndexField
indexField :: IndexField
$sel:indexField:DefineIndexField' :: DefineIndexField -> IndexField
indexField} -> IndexField
indexField) (\s :: DefineIndexField
s@DefineIndexField' {} IndexField
a -> DefineIndexField
s {$sel:indexField:DefineIndexField' :: IndexField
indexField = IndexField
a} :: DefineIndexField)
instance Core.AWSRequest DefineIndexField where
type
AWSResponse DefineIndexField =
DefineIndexFieldResponse
request :: DefineIndexField -> Request DefineIndexField
request = Service -> DefineIndexField -> Request DefineIndexField
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DefineIndexField
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DefineIndexField)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DefineIndexField))
-> Logger
-> Service
-> Proxy DefineIndexField
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DefineIndexField)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"DefineIndexFieldResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> IndexFieldStatus -> DefineIndexFieldResponse
DefineIndexFieldResponse'
(Int -> IndexFieldStatus -> DefineIndexFieldResponse)
-> Either String Int
-> Either String (IndexFieldStatus -> DefineIndexFieldResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (IndexFieldStatus -> DefineIndexFieldResponse)
-> Either String IndexFieldStatus
-> Either String DefineIndexFieldResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String IndexFieldStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"IndexField")
)
instance Prelude.Hashable DefineIndexField
instance Prelude.NFData DefineIndexField
instance Core.ToHeaders DefineIndexField where
toHeaders :: DefineIndexField -> ResponseHeaders
toHeaders = ResponseHeaders -> DefineIndexField -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DefineIndexField where
toPath :: DefineIndexField -> ByteString
toPath = ByteString -> DefineIndexField -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DefineIndexField where
toQuery :: DefineIndexField -> QueryString
toQuery DefineIndexField' {Text
IndexField
indexField :: IndexField
domainName :: Text
$sel:indexField:DefineIndexField' :: DefineIndexField -> IndexField
$sel:domainName:DefineIndexField' :: DefineIndexField -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DefineIndexField" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2013-01-01" :: Prelude.ByteString),
ByteString
"DomainName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domainName,
ByteString
"IndexField" ByteString -> IndexField -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: IndexField
indexField
]
data DefineIndexFieldResponse = DefineIndexFieldResponse'
{
DefineIndexFieldResponse -> Int
httpStatus :: Prelude.Int,
DefineIndexFieldResponse -> IndexFieldStatus
indexField :: IndexFieldStatus
}
deriving (DefineIndexFieldResponse -> DefineIndexFieldResponse -> Bool
(DefineIndexFieldResponse -> DefineIndexFieldResponse -> Bool)
-> (DefineIndexFieldResponse -> DefineIndexFieldResponse -> Bool)
-> Eq DefineIndexFieldResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefineIndexFieldResponse -> DefineIndexFieldResponse -> Bool
$c/= :: DefineIndexFieldResponse -> DefineIndexFieldResponse -> Bool
== :: DefineIndexFieldResponse -> DefineIndexFieldResponse -> Bool
$c== :: DefineIndexFieldResponse -> DefineIndexFieldResponse -> Bool
Prelude.Eq, ReadPrec [DefineIndexFieldResponse]
ReadPrec DefineIndexFieldResponse
Int -> ReadS DefineIndexFieldResponse
ReadS [DefineIndexFieldResponse]
(Int -> ReadS DefineIndexFieldResponse)
-> ReadS [DefineIndexFieldResponse]
-> ReadPrec DefineIndexFieldResponse
-> ReadPrec [DefineIndexFieldResponse]
-> Read DefineIndexFieldResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefineIndexFieldResponse]
$creadListPrec :: ReadPrec [DefineIndexFieldResponse]
readPrec :: ReadPrec DefineIndexFieldResponse
$creadPrec :: ReadPrec DefineIndexFieldResponse
readList :: ReadS [DefineIndexFieldResponse]
$creadList :: ReadS [DefineIndexFieldResponse]
readsPrec :: Int -> ReadS DefineIndexFieldResponse
$creadsPrec :: Int -> ReadS DefineIndexFieldResponse
Prelude.Read, Int -> DefineIndexFieldResponse -> ShowS
[DefineIndexFieldResponse] -> ShowS
DefineIndexFieldResponse -> String
(Int -> DefineIndexFieldResponse -> ShowS)
-> (DefineIndexFieldResponse -> String)
-> ([DefineIndexFieldResponse] -> ShowS)
-> Show DefineIndexFieldResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefineIndexFieldResponse] -> ShowS
$cshowList :: [DefineIndexFieldResponse] -> ShowS
show :: DefineIndexFieldResponse -> String
$cshow :: DefineIndexFieldResponse -> String
showsPrec :: Int -> DefineIndexFieldResponse -> ShowS
$cshowsPrec :: Int -> DefineIndexFieldResponse -> ShowS
Prelude.Show, (forall x.
DefineIndexFieldResponse -> Rep DefineIndexFieldResponse x)
-> (forall x.
Rep DefineIndexFieldResponse x -> DefineIndexFieldResponse)
-> Generic DefineIndexFieldResponse
forall x.
Rep DefineIndexFieldResponse x -> DefineIndexFieldResponse
forall x.
DefineIndexFieldResponse -> Rep DefineIndexFieldResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DefineIndexFieldResponse x -> DefineIndexFieldResponse
$cfrom :: forall x.
DefineIndexFieldResponse -> Rep DefineIndexFieldResponse x
Prelude.Generic)
newDefineIndexFieldResponse ::
Prelude.Int ->
IndexFieldStatus ->
DefineIndexFieldResponse
newDefineIndexFieldResponse :: Int -> IndexFieldStatus -> DefineIndexFieldResponse
newDefineIndexFieldResponse Int
pHttpStatus_ IndexFieldStatus
pIndexField_ =
DefineIndexFieldResponse' :: Int -> IndexFieldStatus -> DefineIndexFieldResponse
DefineIndexFieldResponse'
{ $sel:httpStatus:DefineIndexFieldResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:indexField:DefineIndexFieldResponse' :: IndexFieldStatus
indexField = IndexFieldStatus
pIndexField_
}
defineIndexFieldResponse_httpStatus :: Lens.Lens' DefineIndexFieldResponse Prelude.Int
defineIndexFieldResponse_httpStatus :: (Int -> f Int)
-> DefineIndexFieldResponse -> f DefineIndexFieldResponse
defineIndexFieldResponse_httpStatus = (DefineIndexFieldResponse -> Int)
-> (DefineIndexFieldResponse -> Int -> DefineIndexFieldResponse)
-> Lens DefineIndexFieldResponse DefineIndexFieldResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineIndexFieldResponse' {Int
httpStatus :: Int
$sel:httpStatus:DefineIndexFieldResponse' :: DefineIndexFieldResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DefineIndexFieldResponse
s@DefineIndexFieldResponse' {} Int
a -> DefineIndexFieldResponse
s {$sel:httpStatus:DefineIndexFieldResponse' :: Int
httpStatus = Int
a} :: DefineIndexFieldResponse)
defineIndexFieldResponse_indexField :: Lens.Lens' DefineIndexFieldResponse IndexFieldStatus
defineIndexFieldResponse_indexField :: (IndexFieldStatus -> f IndexFieldStatus)
-> DefineIndexFieldResponse -> f DefineIndexFieldResponse
defineIndexFieldResponse_indexField = (DefineIndexFieldResponse -> IndexFieldStatus)
-> (DefineIndexFieldResponse
-> IndexFieldStatus -> DefineIndexFieldResponse)
-> Lens
DefineIndexFieldResponse
DefineIndexFieldResponse
IndexFieldStatus
IndexFieldStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefineIndexFieldResponse' {IndexFieldStatus
indexField :: IndexFieldStatus
$sel:indexField:DefineIndexFieldResponse' :: DefineIndexFieldResponse -> IndexFieldStatus
indexField} -> IndexFieldStatus
indexField) (\s :: DefineIndexFieldResponse
s@DefineIndexFieldResponse' {} IndexFieldStatus
a -> DefineIndexFieldResponse
s {$sel:indexField:DefineIndexFieldResponse' :: IndexFieldStatus
indexField = IndexFieldStatus
a} :: DefineIndexFieldResponse)
instance Prelude.NFData DefineIndexFieldResponse