{-# 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.UpdateThingGroupsForThing
(
UpdateThingGroupsForThing (..),
newUpdateThingGroupsForThing,
updateThingGroupsForThing_overrideDynamicGroups,
updateThingGroupsForThing_thingGroupsToAdd,
updateThingGroupsForThing_thingGroupsToRemove,
updateThingGroupsForThing_thingName,
UpdateThingGroupsForThingResponse (..),
newUpdateThingGroupsForThingResponse,
updateThingGroupsForThingResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateThingGroupsForThing = UpdateThingGroupsForThing'
{
UpdateThingGroupsForThing -> Maybe Bool
overrideDynamicGroups :: Prelude.Maybe Prelude.Bool,
UpdateThingGroupsForThing -> Maybe [Text]
thingGroupsToAdd :: Prelude.Maybe [Prelude.Text],
UpdateThingGroupsForThing -> Maybe [Text]
thingGroupsToRemove :: Prelude.Maybe [Prelude.Text],
UpdateThingGroupsForThing -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text
}
deriving (UpdateThingGroupsForThing -> UpdateThingGroupsForThing -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateThingGroupsForThing -> UpdateThingGroupsForThing -> Bool
$c/= :: UpdateThingGroupsForThing -> UpdateThingGroupsForThing -> Bool
== :: UpdateThingGroupsForThing -> UpdateThingGroupsForThing -> Bool
$c== :: UpdateThingGroupsForThing -> UpdateThingGroupsForThing -> Bool
Prelude.Eq, ReadPrec [UpdateThingGroupsForThing]
ReadPrec UpdateThingGroupsForThing
Int -> ReadS UpdateThingGroupsForThing
ReadS [UpdateThingGroupsForThing]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateThingGroupsForThing]
$creadListPrec :: ReadPrec [UpdateThingGroupsForThing]
readPrec :: ReadPrec UpdateThingGroupsForThing
$creadPrec :: ReadPrec UpdateThingGroupsForThing
readList :: ReadS [UpdateThingGroupsForThing]
$creadList :: ReadS [UpdateThingGroupsForThing]
readsPrec :: Int -> ReadS UpdateThingGroupsForThing
$creadsPrec :: Int -> ReadS UpdateThingGroupsForThing
Prelude.Read, Int -> UpdateThingGroupsForThing -> ShowS
[UpdateThingGroupsForThing] -> ShowS
UpdateThingGroupsForThing -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateThingGroupsForThing] -> ShowS
$cshowList :: [UpdateThingGroupsForThing] -> ShowS
show :: UpdateThingGroupsForThing -> String
$cshow :: UpdateThingGroupsForThing -> String
showsPrec :: Int -> UpdateThingGroupsForThing -> ShowS
$cshowsPrec :: Int -> UpdateThingGroupsForThing -> ShowS
Prelude.Show, forall x.
Rep UpdateThingGroupsForThing x -> UpdateThingGroupsForThing
forall x.
UpdateThingGroupsForThing -> Rep UpdateThingGroupsForThing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateThingGroupsForThing x -> UpdateThingGroupsForThing
$cfrom :: forall x.
UpdateThingGroupsForThing -> Rep UpdateThingGroupsForThing x
Prelude.Generic)
newUpdateThingGroupsForThing ::
UpdateThingGroupsForThing
newUpdateThingGroupsForThing :: UpdateThingGroupsForThing
newUpdateThingGroupsForThing =
UpdateThingGroupsForThing'
{ $sel:overrideDynamicGroups:UpdateThingGroupsForThing' :: Maybe Bool
overrideDynamicGroups =
forall a. Maybe a
Prelude.Nothing,
$sel:thingGroupsToAdd:UpdateThingGroupsForThing' :: Maybe [Text]
thingGroupsToAdd = forall a. Maybe a
Prelude.Nothing,
$sel:thingGroupsToRemove:UpdateThingGroupsForThing' :: Maybe [Text]
thingGroupsToRemove = forall a. Maybe a
Prelude.Nothing,
$sel:thingName:UpdateThingGroupsForThing' :: Maybe Text
thingName = forall a. Maybe a
Prelude.Nothing
}
updateThingGroupsForThing_overrideDynamicGroups :: Lens.Lens' UpdateThingGroupsForThing (Prelude.Maybe Prelude.Bool)
updateThingGroupsForThing_overrideDynamicGroups :: Lens' UpdateThingGroupsForThing (Maybe Bool)
updateThingGroupsForThing_overrideDynamicGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingGroupsForThing' {Maybe Bool
overrideDynamicGroups :: Maybe Bool
$sel:overrideDynamicGroups:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Bool
overrideDynamicGroups} -> Maybe Bool
overrideDynamicGroups) (\s :: UpdateThingGroupsForThing
s@UpdateThingGroupsForThing' {} Maybe Bool
a -> UpdateThingGroupsForThing
s {$sel:overrideDynamicGroups:UpdateThingGroupsForThing' :: Maybe Bool
overrideDynamicGroups = Maybe Bool
a} :: UpdateThingGroupsForThing)
updateThingGroupsForThing_thingGroupsToAdd :: Lens.Lens' UpdateThingGroupsForThing (Prelude.Maybe [Prelude.Text])
updateThingGroupsForThing_thingGroupsToAdd :: Lens' UpdateThingGroupsForThing (Maybe [Text])
updateThingGroupsForThing_thingGroupsToAdd = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingGroupsForThing' {Maybe [Text]
thingGroupsToAdd :: Maybe [Text]
$sel:thingGroupsToAdd:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
thingGroupsToAdd} -> Maybe [Text]
thingGroupsToAdd) (\s :: UpdateThingGroupsForThing
s@UpdateThingGroupsForThing' {} Maybe [Text]
a -> UpdateThingGroupsForThing
s {$sel:thingGroupsToAdd:UpdateThingGroupsForThing' :: Maybe [Text]
thingGroupsToAdd = Maybe [Text]
a} :: UpdateThingGroupsForThing) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateThingGroupsForThing_thingGroupsToRemove :: Lens.Lens' UpdateThingGroupsForThing (Prelude.Maybe [Prelude.Text])
updateThingGroupsForThing_thingGroupsToRemove :: Lens' UpdateThingGroupsForThing (Maybe [Text])
updateThingGroupsForThing_thingGroupsToRemove = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingGroupsForThing' {Maybe [Text]
thingGroupsToRemove :: Maybe [Text]
$sel:thingGroupsToRemove:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
thingGroupsToRemove} -> Maybe [Text]
thingGroupsToRemove) (\s :: UpdateThingGroupsForThing
s@UpdateThingGroupsForThing' {} Maybe [Text]
a -> UpdateThingGroupsForThing
s {$sel:thingGroupsToRemove:UpdateThingGroupsForThing' :: Maybe [Text]
thingGroupsToRemove = Maybe [Text]
a} :: UpdateThingGroupsForThing) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateThingGroupsForThing_thingName :: Lens.Lens' UpdateThingGroupsForThing (Prelude.Maybe Prelude.Text)
updateThingGroupsForThing_thingName :: Lens' UpdateThingGroupsForThing (Maybe Text)
updateThingGroupsForThing_thingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingGroupsForThing' {Maybe Text
thingName :: Maybe Text
$sel:thingName:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: UpdateThingGroupsForThing
s@UpdateThingGroupsForThing' {} Maybe Text
a -> UpdateThingGroupsForThing
s {$sel:thingName:UpdateThingGroupsForThing' :: Maybe Text
thingName = Maybe Text
a} :: UpdateThingGroupsForThing)
instance Core.AWSRequest UpdateThingGroupsForThing where
type
AWSResponse UpdateThingGroupsForThing =
UpdateThingGroupsForThingResponse
request :: (Service -> Service)
-> UpdateThingGroupsForThing -> Request UpdateThingGroupsForThing
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateThingGroupsForThing
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateThingGroupsForThing)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateThingGroupsForThingResponse
UpdateThingGroupsForThingResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateThingGroupsForThing where
hashWithSalt :: Int -> UpdateThingGroupsForThing -> Int
hashWithSalt Int
_salt UpdateThingGroupsForThing' {Maybe Bool
Maybe [Text]
Maybe Text
thingName :: Maybe Text
thingGroupsToRemove :: Maybe [Text]
thingGroupsToAdd :: Maybe [Text]
overrideDynamicGroups :: Maybe Bool
$sel:thingName:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Text
$sel:thingGroupsToRemove:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
$sel:thingGroupsToAdd:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
$sel:overrideDynamicGroups:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
overrideDynamicGroups
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
thingGroupsToAdd
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
thingGroupsToRemove
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingName
instance Prelude.NFData UpdateThingGroupsForThing where
rnf :: UpdateThingGroupsForThing -> ()
rnf UpdateThingGroupsForThing' {Maybe Bool
Maybe [Text]
Maybe Text
thingName :: Maybe Text
thingGroupsToRemove :: Maybe [Text]
thingGroupsToAdd :: Maybe [Text]
overrideDynamicGroups :: Maybe Bool
$sel:thingName:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Text
$sel:thingGroupsToRemove:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
$sel:thingGroupsToAdd:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
$sel:overrideDynamicGroups:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
overrideDynamicGroups
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
thingGroupsToAdd
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
thingGroupsToRemove
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingName
instance Data.ToHeaders UpdateThingGroupsForThing where
toHeaders :: UpdateThingGroupsForThing -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON UpdateThingGroupsForThing where
toJSON :: UpdateThingGroupsForThing -> Value
toJSON UpdateThingGroupsForThing' {Maybe Bool
Maybe [Text]
Maybe Text
thingName :: Maybe Text
thingGroupsToRemove :: Maybe [Text]
thingGroupsToAdd :: Maybe [Text]
overrideDynamicGroups :: Maybe Bool
$sel:thingName:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Text
$sel:thingGroupsToRemove:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
$sel:thingGroupsToAdd:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe [Text]
$sel:overrideDynamicGroups:UpdateThingGroupsForThing' :: UpdateThingGroupsForThing -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"overrideDynamicGroups" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
overrideDynamicGroups,
(Key
"thingGroupsToAdd" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
thingGroupsToAdd,
(Key
"thingGroupsToRemove" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
thingGroupsToRemove,
(Key
"thingName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
thingName
]
)
instance Data.ToPath UpdateThingGroupsForThing where
toPath :: UpdateThingGroupsForThing -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const
ByteString
"/thing-groups/updateThingGroupsForThing"
instance Data.ToQuery UpdateThingGroupsForThing where
toQuery :: UpdateThingGroupsForThing -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateThingGroupsForThingResponse = UpdateThingGroupsForThingResponse'
{
UpdateThingGroupsForThingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateThingGroupsForThingResponse
-> UpdateThingGroupsForThingResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateThingGroupsForThingResponse
-> UpdateThingGroupsForThingResponse -> Bool
$c/= :: UpdateThingGroupsForThingResponse
-> UpdateThingGroupsForThingResponse -> Bool
== :: UpdateThingGroupsForThingResponse
-> UpdateThingGroupsForThingResponse -> Bool
$c== :: UpdateThingGroupsForThingResponse
-> UpdateThingGroupsForThingResponse -> Bool
Prelude.Eq, ReadPrec [UpdateThingGroupsForThingResponse]
ReadPrec UpdateThingGroupsForThingResponse
Int -> ReadS UpdateThingGroupsForThingResponse
ReadS [UpdateThingGroupsForThingResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateThingGroupsForThingResponse]
$creadListPrec :: ReadPrec [UpdateThingGroupsForThingResponse]
readPrec :: ReadPrec UpdateThingGroupsForThingResponse
$creadPrec :: ReadPrec UpdateThingGroupsForThingResponse
readList :: ReadS [UpdateThingGroupsForThingResponse]
$creadList :: ReadS [UpdateThingGroupsForThingResponse]
readsPrec :: Int -> ReadS UpdateThingGroupsForThingResponse
$creadsPrec :: Int -> ReadS UpdateThingGroupsForThingResponse
Prelude.Read, Int -> UpdateThingGroupsForThingResponse -> ShowS
[UpdateThingGroupsForThingResponse] -> ShowS
UpdateThingGroupsForThingResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateThingGroupsForThingResponse] -> ShowS
$cshowList :: [UpdateThingGroupsForThingResponse] -> ShowS
show :: UpdateThingGroupsForThingResponse -> String
$cshow :: UpdateThingGroupsForThingResponse -> String
showsPrec :: Int -> UpdateThingGroupsForThingResponse -> ShowS
$cshowsPrec :: Int -> UpdateThingGroupsForThingResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateThingGroupsForThingResponse x
-> UpdateThingGroupsForThingResponse
forall x.
UpdateThingGroupsForThingResponse
-> Rep UpdateThingGroupsForThingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateThingGroupsForThingResponse x
-> UpdateThingGroupsForThingResponse
$cfrom :: forall x.
UpdateThingGroupsForThingResponse
-> Rep UpdateThingGroupsForThingResponse x
Prelude.Generic)
newUpdateThingGroupsForThingResponse ::
Prelude.Int ->
UpdateThingGroupsForThingResponse
newUpdateThingGroupsForThingResponse :: Int -> UpdateThingGroupsForThingResponse
newUpdateThingGroupsForThingResponse Int
pHttpStatus_ =
UpdateThingGroupsForThingResponse'
{ $sel:httpStatus:UpdateThingGroupsForThingResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateThingGroupsForThingResponse_httpStatus :: Lens.Lens' UpdateThingGroupsForThingResponse Prelude.Int
updateThingGroupsForThingResponse_httpStatus :: Lens' UpdateThingGroupsForThingResponse Int
updateThingGroupsForThingResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingGroupsForThingResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateThingGroupsForThingResponse' :: UpdateThingGroupsForThingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateThingGroupsForThingResponse
s@UpdateThingGroupsForThingResponse' {} Int
a -> UpdateThingGroupsForThingResponse
s {$sel:httpStatus:UpdateThingGroupsForThingResponse' :: Int
httpStatus = Int
a} :: UpdateThingGroupsForThingResponse)
instance
Prelude.NFData
UpdateThingGroupsForThingResponse
where
rnf :: UpdateThingGroupsForThingResponse -> ()
rnf UpdateThingGroupsForThingResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateThingGroupsForThingResponse' :: UpdateThingGroupsForThingResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus