{-# 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.AddThingsToThingGroupParams where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AddThingsToThingGroupParams = AddThingsToThingGroupParams'
{
AddThingsToThingGroupParams -> Maybe Bool
overrideDynamicGroups :: Prelude.Maybe Prelude.Bool,
AddThingsToThingGroupParams -> NonEmpty Text
thingGroupNames :: Prelude.NonEmpty Prelude.Text
}
deriving (AddThingsToThingGroupParams -> AddThingsToThingGroupParams -> Bool
(AddThingsToThingGroupParams
-> AddThingsToThingGroupParams -> Bool)
-> (AddThingsToThingGroupParams
-> AddThingsToThingGroupParams -> Bool)
-> Eq AddThingsToThingGroupParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddThingsToThingGroupParams -> AddThingsToThingGroupParams -> Bool
$c/= :: AddThingsToThingGroupParams -> AddThingsToThingGroupParams -> Bool
== :: AddThingsToThingGroupParams -> AddThingsToThingGroupParams -> Bool
$c== :: AddThingsToThingGroupParams -> AddThingsToThingGroupParams -> Bool
Prelude.Eq, ReadPrec [AddThingsToThingGroupParams]
ReadPrec AddThingsToThingGroupParams
Int -> ReadS AddThingsToThingGroupParams
ReadS [AddThingsToThingGroupParams]
(Int -> ReadS AddThingsToThingGroupParams)
-> ReadS [AddThingsToThingGroupParams]
-> ReadPrec AddThingsToThingGroupParams
-> ReadPrec [AddThingsToThingGroupParams]
-> Read AddThingsToThingGroupParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddThingsToThingGroupParams]
$creadListPrec :: ReadPrec [AddThingsToThingGroupParams]
readPrec :: ReadPrec AddThingsToThingGroupParams
$creadPrec :: ReadPrec AddThingsToThingGroupParams
readList :: ReadS [AddThingsToThingGroupParams]
$creadList :: ReadS [AddThingsToThingGroupParams]
readsPrec :: Int -> ReadS AddThingsToThingGroupParams
$creadsPrec :: Int -> ReadS AddThingsToThingGroupParams
Prelude.Read, Int -> AddThingsToThingGroupParams -> ShowS
[AddThingsToThingGroupParams] -> ShowS
AddThingsToThingGroupParams -> String
(Int -> AddThingsToThingGroupParams -> ShowS)
-> (AddThingsToThingGroupParams -> String)
-> ([AddThingsToThingGroupParams] -> ShowS)
-> Show AddThingsToThingGroupParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddThingsToThingGroupParams] -> ShowS
$cshowList :: [AddThingsToThingGroupParams] -> ShowS
show :: AddThingsToThingGroupParams -> String
$cshow :: AddThingsToThingGroupParams -> String
showsPrec :: Int -> AddThingsToThingGroupParams -> ShowS
$cshowsPrec :: Int -> AddThingsToThingGroupParams -> ShowS
Prelude.Show, (forall x.
AddThingsToThingGroupParams -> Rep AddThingsToThingGroupParams x)
-> (forall x.
Rep AddThingsToThingGroupParams x -> AddThingsToThingGroupParams)
-> Generic AddThingsToThingGroupParams
forall x.
Rep AddThingsToThingGroupParams x -> AddThingsToThingGroupParams
forall x.
AddThingsToThingGroupParams -> Rep AddThingsToThingGroupParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddThingsToThingGroupParams x -> AddThingsToThingGroupParams
$cfrom :: forall x.
AddThingsToThingGroupParams -> Rep AddThingsToThingGroupParams x
Prelude.Generic)
newAddThingsToThingGroupParams ::
Prelude.NonEmpty Prelude.Text ->
AddThingsToThingGroupParams
newAddThingsToThingGroupParams :: NonEmpty Text -> AddThingsToThingGroupParams
newAddThingsToThingGroupParams NonEmpty Text
pThingGroupNames_ =
AddThingsToThingGroupParams' :: Maybe Bool -> NonEmpty Text -> AddThingsToThingGroupParams
AddThingsToThingGroupParams'
{ $sel:overrideDynamicGroups:AddThingsToThingGroupParams' :: Maybe Bool
overrideDynamicGroups =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:thingGroupNames:AddThingsToThingGroupParams' :: NonEmpty Text
thingGroupNames =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pThingGroupNames_
}
addThingsToThingGroupParams_overrideDynamicGroups :: Lens.Lens' AddThingsToThingGroupParams (Prelude.Maybe Prelude.Bool)
addThingsToThingGroupParams_overrideDynamicGroups :: (Maybe Bool -> f (Maybe Bool))
-> AddThingsToThingGroupParams -> f AddThingsToThingGroupParams
addThingsToThingGroupParams_overrideDynamicGroups = (AddThingsToThingGroupParams -> Maybe Bool)
-> (AddThingsToThingGroupParams
-> Maybe Bool -> AddThingsToThingGroupParams)
-> Lens
AddThingsToThingGroupParams
AddThingsToThingGroupParams
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingsToThingGroupParams' {Maybe Bool
overrideDynamicGroups :: Maybe Bool
$sel:overrideDynamicGroups:AddThingsToThingGroupParams' :: AddThingsToThingGroupParams -> Maybe Bool
overrideDynamicGroups} -> Maybe Bool
overrideDynamicGroups) (\s :: AddThingsToThingGroupParams
s@AddThingsToThingGroupParams' {} Maybe Bool
a -> AddThingsToThingGroupParams
s {$sel:overrideDynamicGroups:AddThingsToThingGroupParams' :: Maybe Bool
overrideDynamicGroups = Maybe Bool
a} :: AddThingsToThingGroupParams)
addThingsToThingGroupParams_thingGroupNames :: Lens.Lens' AddThingsToThingGroupParams (Prelude.NonEmpty Prelude.Text)
addThingsToThingGroupParams_thingGroupNames :: (NonEmpty Text -> f (NonEmpty Text))
-> AddThingsToThingGroupParams -> f AddThingsToThingGroupParams
addThingsToThingGroupParams_thingGroupNames = (AddThingsToThingGroupParams -> NonEmpty Text)
-> (AddThingsToThingGroupParams
-> NonEmpty Text -> AddThingsToThingGroupParams)
-> Lens
AddThingsToThingGroupParams
AddThingsToThingGroupParams
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingsToThingGroupParams' {NonEmpty Text
thingGroupNames :: NonEmpty Text
$sel:thingGroupNames:AddThingsToThingGroupParams' :: AddThingsToThingGroupParams -> NonEmpty Text
thingGroupNames} -> NonEmpty Text
thingGroupNames) (\s :: AddThingsToThingGroupParams
s@AddThingsToThingGroupParams' {} NonEmpty Text
a -> AddThingsToThingGroupParams
s {$sel:thingGroupNames:AddThingsToThingGroupParams' :: NonEmpty Text
thingGroupNames = NonEmpty Text
a} :: AddThingsToThingGroupParams) ((NonEmpty Text -> f (NonEmpty Text))
-> AddThingsToThingGroupParams -> f AddThingsToThingGroupParams)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> AddThingsToThingGroupParams
-> f AddThingsToThingGroupParams
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON AddThingsToThingGroupParams where
parseJSON :: Value -> Parser AddThingsToThingGroupParams
parseJSON =
String
-> (Object -> Parser AddThingsToThingGroupParams)
-> Value
-> Parser AddThingsToThingGroupParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AddThingsToThingGroupParams"
( \Object
x ->
Maybe Bool -> NonEmpty Text -> AddThingsToThingGroupParams
AddThingsToThingGroupParams'
(Maybe Bool -> NonEmpty Text -> AddThingsToThingGroupParams)
-> Parser (Maybe Bool)
-> Parser (NonEmpty Text -> AddThingsToThingGroupParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"overrideDynamicGroups")
Parser (NonEmpty Text -> AddThingsToThingGroupParams)
-> Parser (NonEmpty Text) -> Parser AddThingsToThingGroupParams
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"thingGroupNames")
)
instance Prelude.Hashable AddThingsToThingGroupParams
instance Prelude.NFData AddThingsToThingGroupParams
instance Core.ToJSON AddThingsToThingGroupParams where
toJSON :: AddThingsToThingGroupParams -> Value
toJSON AddThingsToThingGroupParams' {Maybe Bool
NonEmpty Text
thingGroupNames :: NonEmpty Text
overrideDynamicGroups :: Maybe Bool
$sel:thingGroupNames:AddThingsToThingGroupParams' :: AddThingsToThingGroupParams -> NonEmpty Text
$sel:overrideDynamicGroups:AddThingsToThingGroupParams' :: AddThingsToThingGroupParams -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"overrideDynamicGroups" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
overrideDynamicGroups,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"thingGroupNames" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
thingGroupNames)
]
)