{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IoT.Types.OpenSearchAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OpenSearchAction = OpenSearchAction'
{
OpenSearchAction -> Text
roleArn :: Prelude.Text,
OpenSearchAction -> Text
endpoint :: Prelude.Text,
OpenSearchAction -> Text
index :: Prelude.Text,
OpenSearchAction -> Text
type' :: Prelude.Text,
OpenSearchAction -> Text
id :: Prelude.Text
}
deriving (OpenSearchAction -> OpenSearchAction -> Bool
(OpenSearchAction -> OpenSearchAction -> Bool)
-> (OpenSearchAction -> OpenSearchAction -> Bool)
-> Eq OpenSearchAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpenSearchAction -> OpenSearchAction -> Bool
$c/= :: OpenSearchAction -> OpenSearchAction -> Bool
== :: OpenSearchAction -> OpenSearchAction -> Bool
$c== :: OpenSearchAction -> OpenSearchAction -> Bool
Prelude.Eq, ReadPrec [OpenSearchAction]
ReadPrec OpenSearchAction
Int -> ReadS OpenSearchAction
ReadS [OpenSearchAction]
(Int -> ReadS OpenSearchAction)
-> ReadS [OpenSearchAction]
-> ReadPrec OpenSearchAction
-> ReadPrec [OpenSearchAction]
-> Read OpenSearchAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OpenSearchAction]
$creadListPrec :: ReadPrec [OpenSearchAction]
readPrec :: ReadPrec OpenSearchAction
$creadPrec :: ReadPrec OpenSearchAction
readList :: ReadS [OpenSearchAction]
$creadList :: ReadS [OpenSearchAction]
readsPrec :: Int -> ReadS OpenSearchAction
$creadsPrec :: Int -> ReadS OpenSearchAction
Prelude.Read, Int -> OpenSearchAction -> ShowS
[OpenSearchAction] -> ShowS
OpenSearchAction -> String
(Int -> OpenSearchAction -> ShowS)
-> (OpenSearchAction -> String)
-> ([OpenSearchAction] -> ShowS)
-> Show OpenSearchAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpenSearchAction] -> ShowS
$cshowList :: [OpenSearchAction] -> ShowS
show :: OpenSearchAction -> String
$cshow :: OpenSearchAction -> String
showsPrec :: Int -> OpenSearchAction -> ShowS
$cshowsPrec :: Int -> OpenSearchAction -> ShowS
Prelude.Show, (forall x. OpenSearchAction -> Rep OpenSearchAction x)
-> (forall x. Rep OpenSearchAction x -> OpenSearchAction)
-> Generic OpenSearchAction
forall x. Rep OpenSearchAction x -> OpenSearchAction
forall x. OpenSearchAction -> Rep OpenSearchAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OpenSearchAction x -> OpenSearchAction
$cfrom :: forall x. OpenSearchAction -> Rep OpenSearchAction x
Prelude.Generic)
newOpenSearchAction ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
OpenSearchAction
newOpenSearchAction :: Text -> Text -> Text -> Text -> Text -> OpenSearchAction
newOpenSearchAction
Text
pRoleArn_
Text
pEndpoint_
Text
pIndex_
Text
pType_
Text
pId_ =
OpenSearchAction' :: Text -> Text -> Text -> Text -> Text -> OpenSearchAction
OpenSearchAction'
{ $sel:roleArn:OpenSearchAction' :: Text
roleArn = Text
pRoleArn_,
$sel:endpoint:OpenSearchAction' :: Text
endpoint = Text
pEndpoint_,
$sel:index:OpenSearchAction' :: Text
index = Text
pIndex_,
$sel:type':OpenSearchAction' :: Text
type' = Text
pType_,
$sel:id:OpenSearchAction' :: Text
id = Text
pId_
}
openSearchAction_roleArn :: Lens.Lens' OpenSearchAction Prelude.Text
openSearchAction_roleArn :: (Text -> f Text) -> OpenSearchAction -> f OpenSearchAction
openSearchAction_roleArn = (OpenSearchAction -> Text)
-> (OpenSearchAction -> Text -> OpenSearchAction)
-> Lens OpenSearchAction OpenSearchAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenSearchAction' {Text
roleArn :: Text
$sel:roleArn:OpenSearchAction' :: OpenSearchAction -> Text
roleArn} -> Text
roleArn) (\s :: OpenSearchAction
s@OpenSearchAction' {} Text
a -> OpenSearchAction
s {$sel:roleArn:OpenSearchAction' :: Text
roleArn = Text
a} :: OpenSearchAction)
openSearchAction_endpoint :: Lens.Lens' OpenSearchAction Prelude.Text
openSearchAction_endpoint :: (Text -> f Text) -> OpenSearchAction -> f OpenSearchAction
openSearchAction_endpoint = (OpenSearchAction -> Text)
-> (OpenSearchAction -> Text -> OpenSearchAction)
-> Lens OpenSearchAction OpenSearchAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenSearchAction' {Text
endpoint :: Text
$sel:endpoint:OpenSearchAction' :: OpenSearchAction -> Text
endpoint} -> Text
endpoint) (\s :: OpenSearchAction
s@OpenSearchAction' {} Text
a -> OpenSearchAction
s {$sel:endpoint:OpenSearchAction' :: Text
endpoint = Text
a} :: OpenSearchAction)
openSearchAction_index :: Lens.Lens' OpenSearchAction Prelude.Text
openSearchAction_index :: (Text -> f Text) -> OpenSearchAction -> f OpenSearchAction
openSearchAction_index = (OpenSearchAction -> Text)
-> (OpenSearchAction -> Text -> OpenSearchAction)
-> Lens OpenSearchAction OpenSearchAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenSearchAction' {Text
index :: Text
$sel:index:OpenSearchAction' :: OpenSearchAction -> Text
index} -> Text
index) (\s :: OpenSearchAction
s@OpenSearchAction' {} Text
a -> OpenSearchAction
s {$sel:index:OpenSearchAction' :: Text
index = Text
a} :: OpenSearchAction)
openSearchAction_type :: Lens.Lens' OpenSearchAction Prelude.Text
openSearchAction_type :: (Text -> f Text) -> OpenSearchAction -> f OpenSearchAction
openSearchAction_type = (OpenSearchAction -> Text)
-> (OpenSearchAction -> Text -> OpenSearchAction)
-> Lens OpenSearchAction OpenSearchAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenSearchAction' {Text
type' :: Text
$sel:type':OpenSearchAction' :: OpenSearchAction -> Text
type'} -> Text
type') (\s :: OpenSearchAction
s@OpenSearchAction' {} Text
a -> OpenSearchAction
s {$sel:type':OpenSearchAction' :: Text
type' = Text
a} :: OpenSearchAction)
openSearchAction_id :: Lens.Lens' OpenSearchAction Prelude.Text
openSearchAction_id :: (Text -> f Text) -> OpenSearchAction -> f OpenSearchAction
openSearchAction_id = (OpenSearchAction -> Text)
-> (OpenSearchAction -> Text -> OpenSearchAction)
-> Lens OpenSearchAction OpenSearchAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenSearchAction' {Text
id :: Text
$sel:id:OpenSearchAction' :: OpenSearchAction -> Text
id} -> Text
id) (\s :: OpenSearchAction
s@OpenSearchAction' {} Text
a -> OpenSearchAction
s {$sel:id:OpenSearchAction' :: Text
id = Text
a} :: OpenSearchAction)
instance Core.FromJSON OpenSearchAction where
parseJSON :: Value -> Parser OpenSearchAction
parseJSON =
String
-> (Object -> Parser OpenSearchAction)
-> Value
-> Parser OpenSearchAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"OpenSearchAction"
( \Object
x ->
Text -> Text -> Text -> Text -> Text -> OpenSearchAction
OpenSearchAction'
(Text -> Text -> Text -> Text -> Text -> OpenSearchAction)
-> Parser Text
-> Parser (Text -> Text -> Text -> Text -> OpenSearchAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
Parser (Text -> Text -> Text -> Text -> OpenSearchAction)
-> Parser Text -> Parser (Text -> Text -> Text -> OpenSearchAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"endpoint")
Parser (Text -> Text -> Text -> OpenSearchAction)
-> Parser Text -> Parser (Text -> Text -> OpenSearchAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"index")
Parser (Text -> Text -> OpenSearchAction)
-> Parser Text -> Parser (Text -> OpenSearchAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
Parser (Text -> OpenSearchAction)
-> Parser Text -> Parser OpenSearchAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"id")
)
instance Prelude.Hashable OpenSearchAction
instance Prelude.NFData OpenSearchAction
instance Core.ToJSON OpenSearchAction where
toJSON :: OpenSearchAction -> Value
toJSON OpenSearchAction' {Text
id :: Text
type' :: Text
index :: Text
endpoint :: Text
roleArn :: Text
$sel:id:OpenSearchAction' :: OpenSearchAction -> Text
$sel:type':OpenSearchAction' :: OpenSearchAction -> Text
$sel:index:OpenSearchAction' :: OpenSearchAction -> Text
$sel:endpoint:OpenSearchAction' :: OpenSearchAction -> Text
$sel:roleArn:OpenSearchAction' :: OpenSearchAction -> 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
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"endpoint" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpoint),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"index" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
index),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
]
)