{-# 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.IoT.AddThingToThingGroup
(
AddThingToThingGroup (..),
newAddThingToThingGroup,
addThingToThingGroup_thingGroupArn,
addThingToThingGroup_thingArn,
addThingToThingGroup_thingGroupName,
addThingToThingGroup_overrideDynamicGroups,
addThingToThingGroup_thingName,
AddThingToThingGroupResponse (..),
newAddThingToThingGroupResponse,
addThingToThingGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
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 AddThingToThingGroup = AddThingToThingGroup'
{
AddThingToThingGroup -> Maybe Text
thingGroupArn :: Prelude.Maybe Prelude.Text,
AddThingToThingGroup -> Maybe Text
thingArn :: Prelude.Maybe Prelude.Text,
AddThingToThingGroup -> Maybe Text
thingGroupName :: Prelude.Maybe Prelude.Text,
AddThingToThingGroup -> Maybe Bool
overrideDynamicGroups :: Prelude.Maybe Prelude.Bool,
AddThingToThingGroup -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text
}
deriving (AddThingToThingGroup -> AddThingToThingGroup -> Bool
(AddThingToThingGroup -> AddThingToThingGroup -> Bool)
-> (AddThingToThingGroup -> AddThingToThingGroup -> Bool)
-> Eq AddThingToThingGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddThingToThingGroup -> AddThingToThingGroup -> Bool
$c/= :: AddThingToThingGroup -> AddThingToThingGroup -> Bool
== :: AddThingToThingGroup -> AddThingToThingGroup -> Bool
$c== :: AddThingToThingGroup -> AddThingToThingGroup -> Bool
Prelude.Eq, ReadPrec [AddThingToThingGroup]
ReadPrec AddThingToThingGroup
Int -> ReadS AddThingToThingGroup
ReadS [AddThingToThingGroup]
(Int -> ReadS AddThingToThingGroup)
-> ReadS [AddThingToThingGroup]
-> ReadPrec AddThingToThingGroup
-> ReadPrec [AddThingToThingGroup]
-> Read AddThingToThingGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddThingToThingGroup]
$creadListPrec :: ReadPrec [AddThingToThingGroup]
readPrec :: ReadPrec AddThingToThingGroup
$creadPrec :: ReadPrec AddThingToThingGroup
readList :: ReadS [AddThingToThingGroup]
$creadList :: ReadS [AddThingToThingGroup]
readsPrec :: Int -> ReadS AddThingToThingGroup
$creadsPrec :: Int -> ReadS AddThingToThingGroup
Prelude.Read, Int -> AddThingToThingGroup -> ShowS
[AddThingToThingGroup] -> ShowS
AddThingToThingGroup -> String
(Int -> AddThingToThingGroup -> ShowS)
-> (AddThingToThingGroup -> String)
-> ([AddThingToThingGroup] -> ShowS)
-> Show AddThingToThingGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddThingToThingGroup] -> ShowS
$cshowList :: [AddThingToThingGroup] -> ShowS
show :: AddThingToThingGroup -> String
$cshow :: AddThingToThingGroup -> String
showsPrec :: Int -> AddThingToThingGroup -> ShowS
$cshowsPrec :: Int -> AddThingToThingGroup -> ShowS
Prelude.Show, (forall x. AddThingToThingGroup -> Rep AddThingToThingGroup x)
-> (forall x. Rep AddThingToThingGroup x -> AddThingToThingGroup)
-> Generic AddThingToThingGroup
forall x. Rep AddThingToThingGroup x -> AddThingToThingGroup
forall x. AddThingToThingGroup -> Rep AddThingToThingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddThingToThingGroup x -> AddThingToThingGroup
$cfrom :: forall x. AddThingToThingGroup -> Rep AddThingToThingGroup x
Prelude.Generic)
newAddThingToThingGroup ::
AddThingToThingGroup
newAddThingToThingGroup :: AddThingToThingGroup
newAddThingToThingGroup =
AddThingToThingGroup' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> AddThingToThingGroup
AddThingToThingGroup'
{ $sel:thingGroupArn:AddThingToThingGroup' :: Maybe Text
thingGroupArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:thingArn:AddThingToThingGroup' :: Maybe Text
thingArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:thingGroupName:AddThingToThingGroup' :: Maybe Text
thingGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:overrideDynamicGroups:AddThingToThingGroup' :: Maybe Bool
overrideDynamicGroups = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:thingName:AddThingToThingGroup' :: Maybe Text
thingName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
addThingToThingGroup_thingGroupArn :: Lens.Lens' AddThingToThingGroup (Prelude.Maybe Prelude.Text)
addThingToThingGroup_thingGroupArn :: (Maybe Text -> f (Maybe Text))
-> AddThingToThingGroup -> f AddThingToThingGroup
addThingToThingGroup_thingGroupArn = (AddThingToThingGroup -> Maybe Text)
-> (AddThingToThingGroup -> Maybe Text -> AddThingToThingGroup)
-> Lens
AddThingToThingGroup AddThingToThingGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToThingGroup' {Maybe Text
thingGroupArn :: Maybe Text
$sel:thingGroupArn:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
thingGroupArn} -> Maybe Text
thingGroupArn) (\s :: AddThingToThingGroup
s@AddThingToThingGroup' {} Maybe Text
a -> AddThingToThingGroup
s {$sel:thingGroupArn:AddThingToThingGroup' :: Maybe Text
thingGroupArn = Maybe Text
a} :: AddThingToThingGroup)
addThingToThingGroup_thingArn :: Lens.Lens' AddThingToThingGroup (Prelude.Maybe Prelude.Text)
addThingToThingGroup_thingArn :: (Maybe Text -> f (Maybe Text))
-> AddThingToThingGroup -> f AddThingToThingGroup
addThingToThingGroup_thingArn = (AddThingToThingGroup -> Maybe Text)
-> (AddThingToThingGroup -> Maybe Text -> AddThingToThingGroup)
-> Lens
AddThingToThingGroup AddThingToThingGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToThingGroup' {Maybe Text
thingArn :: Maybe Text
$sel:thingArn:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
thingArn} -> Maybe Text
thingArn) (\s :: AddThingToThingGroup
s@AddThingToThingGroup' {} Maybe Text
a -> AddThingToThingGroup
s {$sel:thingArn:AddThingToThingGroup' :: Maybe Text
thingArn = Maybe Text
a} :: AddThingToThingGroup)
addThingToThingGroup_thingGroupName :: Lens.Lens' AddThingToThingGroup (Prelude.Maybe Prelude.Text)
addThingToThingGroup_thingGroupName :: (Maybe Text -> f (Maybe Text))
-> AddThingToThingGroup -> f AddThingToThingGroup
addThingToThingGroup_thingGroupName = (AddThingToThingGroup -> Maybe Text)
-> (AddThingToThingGroup -> Maybe Text -> AddThingToThingGroup)
-> Lens
AddThingToThingGroup AddThingToThingGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToThingGroup' {Maybe Text
thingGroupName :: Maybe Text
$sel:thingGroupName:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
thingGroupName} -> Maybe Text
thingGroupName) (\s :: AddThingToThingGroup
s@AddThingToThingGroup' {} Maybe Text
a -> AddThingToThingGroup
s {$sel:thingGroupName:AddThingToThingGroup' :: Maybe Text
thingGroupName = Maybe Text
a} :: AddThingToThingGroup)
addThingToThingGroup_overrideDynamicGroups :: Lens.Lens' AddThingToThingGroup (Prelude.Maybe Prelude.Bool)
addThingToThingGroup_overrideDynamicGroups :: (Maybe Bool -> f (Maybe Bool))
-> AddThingToThingGroup -> f AddThingToThingGroup
addThingToThingGroup_overrideDynamicGroups = (AddThingToThingGroup -> Maybe Bool)
-> (AddThingToThingGroup -> Maybe Bool -> AddThingToThingGroup)
-> Lens
AddThingToThingGroup AddThingToThingGroup (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToThingGroup' {Maybe Bool
overrideDynamicGroups :: Maybe Bool
$sel:overrideDynamicGroups:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Bool
overrideDynamicGroups} -> Maybe Bool
overrideDynamicGroups) (\s :: AddThingToThingGroup
s@AddThingToThingGroup' {} Maybe Bool
a -> AddThingToThingGroup
s {$sel:overrideDynamicGroups:AddThingToThingGroup' :: Maybe Bool
overrideDynamicGroups = Maybe Bool
a} :: AddThingToThingGroup)
addThingToThingGroup_thingName :: Lens.Lens' AddThingToThingGroup (Prelude.Maybe Prelude.Text)
addThingToThingGroup_thingName :: (Maybe Text -> f (Maybe Text))
-> AddThingToThingGroup -> f AddThingToThingGroup
addThingToThingGroup_thingName = (AddThingToThingGroup -> Maybe Text)
-> (AddThingToThingGroup -> Maybe Text -> AddThingToThingGroup)
-> Lens
AddThingToThingGroup AddThingToThingGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToThingGroup' {Maybe Text
thingName :: Maybe Text
$sel:thingName:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: AddThingToThingGroup
s@AddThingToThingGroup' {} Maybe Text
a -> AddThingToThingGroup
s {$sel:thingName:AddThingToThingGroup' :: Maybe Text
thingName = Maybe Text
a} :: AddThingToThingGroup)
instance Core.AWSRequest AddThingToThingGroup where
type
AWSResponse AddThingToThingGroup =
AddThingToThingGroupResponse
request :: AddThingToThingGroup -> Request AddThingToThingGroup
request = Service -> AddThingToThingGroup -> Request AddThingToThingGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddThingToThingGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddThingToThingGroup)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AddThingToThingGroup))
-> Logger
-> Service
-> Proxy AddThingToThingGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddThingToThingGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AddThingToThingGroupResponse
AddThingToThingGroupResponse'
(Int -> AddThingToThingGroupResponse)
-> Either String Int -> Either String AddThingToThingGroupResponse
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))
)
instance Prelude.Hashable AddThingToThingGroup
instance Prelude.NFData AddThingToThingGroup
instance Core.ToHeaders AddThingToThingGroup where
toHeaders :: AddThingToThingGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> AddThingToThingGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON AddThingToThingGroup where
toJSON :: AddThingToThingGroup -> Value
toJSON AddThingToThingGroup' {Maybe Bool
Maybe Text
thingName :: Maybe Text
overrideDynamicGroups :: Maybe Bool
thingGroupName :: Maybe Text
thingArn :: Maybe Text
thingGroupArn :: Maybe Text
$sel:thingName:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
$sel:overrideDynamicGroups:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Bool
$sel:thingGroupName:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
$sel:thingArn:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
$sel:thingGroupArn:AddThingToThingGroup' :: AddThingToThingGroup -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"thingGroupArn" 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
thingGroupArn,
(Text
"thingArn" 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
thingArn,
(Text
"thingGroupName" 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
thingGroupName,
(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,
(Text
"thingName" 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
thingName
]
)
instance Core.ToPath AddThingToThingGroup where
toPath :: AddThingToThingGroup -> ByteString
toPath =
ByteString -> AddThingToThingGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/thing-groups/addThingToThingGroup"
instance Core.ToQuery AddThingToThingGroup where
toQuery :: AddThingToThingGroup -> QueryString
toQuery = QueryString -> AddThingToThingGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddThingToThingGroupResponse = AddThingToThingGroupResponse'
{
AddThingToThingGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddThingToThingGroupResponse
-> AddThingToThingGroupResponse -> Bool
(AddThingToThingGroupResponse
-> AddThingToThingGroupResponse -> Bool)
-> (AddThingToThingGroupResponse
-> AddThingToThingGroupResponse -> Bool)
-> Eq AddThingToThingGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddThingToThingGroupResponse
-> AddThingToThingGroupResponse -> Bool
$c/= :: AddThingToThingGroupResponse
-> AddThingToThingGroupResponse -> Bool
== :: AddThingToThingGroupResponse
-> AddThingToThingGroupResponse -> Bool
$c== :: AddThingToThingGroupResponse
-> AddThingToThingGroupResponse -> Bool
Prelude.Eq, ReadPrec [AddThingToThingGroupResponse]
ReadPrec AddThingToThingGroupResponse
Int -> ReadS AddThingToThingGroupResponse
ReadS [AddThingToThingGroupResponse]
(Int -> ReadS AddThingToThingGroupResponse)
-> ReadS [AddThingToThingGroupResponse]
-> ReadPrec AddThingToThingGroupResponse
-> ReadPrec [AddThingToThingGroupResponse]
-> Read AddThingToThingGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddThingToThingGroupResponse]
$creadListPrec :: ReadPrec [AddThingToThingGroupResponse]
readPrec :: ReadPrec AddThingToThingGroupResponse
$creadPrec :: ReadPrec AddThingToThingGroupResponse
readList :: ReadS [AddThingToThingGroupResponse]
$creadList :: ReadS [AddThingToThingGroupResponse]
readsPrec :: Int -> ReadS AddThingToThingGroupResponse
$creadsPrec :: Int -> ReadS AddThingToThingGroupResponse
Prelude.Read, Int -> AddThingToThingGroupResponse -> ShowS
[AddThingToThingGroupResponse] -> ShowS
AddThingToThingGroupResponse -> String
(Int -> AddThingToThingGroupResponse -> ShowS)
-> (AddThingToThingGroupResponse -> String)
-> ([AddThingToThingGroupResponse] -> ShowS)
-> Show AddThingToThingGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddThingToThingGroupResponse] -> ShowS
$cshowList :: [AddThingToThingGroupResponse] -> ShowS
show :: AddThingToThingGroupResponse -> String
$cshow :: AddThingToThingGroupResponse -> String
showsPrec :: Int -> AddThingToThingGroupResponse -> ShowS
$cshowsPrec :: Int -> AddThingToThingGroupResponse -> ShowS
Prelude.Show, (forall x.
AddThingToThingGroupResponse -> Rep AddThingToThingGroupResponse x)
-> (forall x.
Rep AddThingToThingGroupResponse x -> AddThingToThingGroupResponse)
-> Generic AddThingToThingGroupResponse
forall x.
Rep AddThingToThingGroupResponse x -> AddThingToThingGroupResponse
forall x.
AddThingToThingGroupResponse -> Rep AddThingToThingGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddThingToThingGroupResponse x -> AddThingToThingGroupResponse
$cfrom :: forall x.
AddThingToThingGroupResponse -> Rep AddThingToThingGroupResponse x
Prelude.Generic)
newAddThingToThingGroupResponse ::
Prelude.Int ->
AddThingToThingGroupResponse
newAddThingToThingGroupResponse :: Int -> AddThingToThingGroupResponse
newAddThingToThingGroupResponse Int
pHttpStatus_ =
AddThingToThingGroupResponse' :: Int -> AddThingToThingGroupResponse
AddThingToThingGroupResponse'
{ $sel:httpStatus:AddThingToThingGroupResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
addThingToThingGroupResponse_httpStatus :: Lens.Lens' AddThingToThingGroupResponse Prelude.Int
addThingToThingGroupResponse_httpStatus :: (Int -> f Int)
-> AddThingToThingGroupResponse -> f AddThingToThingGroupResponse
addThingToThingGroupResponse_httpStatus = (AddThingToThingGroupResponse -> Int)
-> (AddThingToThingGroupResponse
-> Int -> AddThingToThingGroupResponse)
-> Lens
AddThingToThingGroupResponse AddThingToThingGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToThingGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddThingToThingGroupResponse' :: AddThingToThingGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddThingToThingGroupResponse
s@AddThingToThingGroupResponse' {} Int
a -> AddThingToThingGroupResponse
s {$sel:httpStatus:AddThingToThingGroupResponse' :: Int
httpStatus = Int
a} :: AddThingToThingGroupResponse)
instance Prelude.NFData AddThingToThingGroupResponse