{-# 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.IoTEventsData.BatchUpdateDetector
(
BatchUpdateDetector (..),
newBatchUpdateDetector,
batchUpdateDetector_detectors,
BatchUpdateDetectorResponse (..),
newBatchUpdateDetectorResponse,
batchUpdateDetectorResponse_batchUpdateDetectorErrorEntries,
batchUpdateDetectorResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.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 BatchUpdateDetector = BatchUpdateDetector'
{
BatchUpdateDetector -> NonEmpty UpdateDetectorRequest
detectors :: Prelude.NonEmpty UpdateDetectorRequest
}
deriving (BatchUpdateDetector -> BatchUpdateDetector -> Bool
(BatchUpdateDetector -> BatchUpdateDetector -> Bool)
-> (BatchUpdateDetector -> BatchUpdateDetector -> Bool)
-> Eq BatchUpdateDetector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateDetector -> BatchUpdateDetector -> Bool
$c/= :: BatchUpdateDetector -> BatchUpdateDetector -> Bool
== :: BatchUpdateDetector -> BatchUpdateDetector -> Bool
$c== :: BatchUpdateDetector -> BatchUpdateDetector -> Bool
Prelude.Eq, ReadPrec [BatchUpdateDetector]
ReadPrec BatchUpdateDetector
Int -> ReadS BatchUpdateDetector
ReadS [BatchUpdateDetector]
(Int -> ReadS BatchUpdateDetector)
-> ReadS [BatchUpdateDetector]
-> ReadPrec BatchUpdateDetector
-> ReadPrec [BatchUpdateDetector]
-> Read BatchUpdateDetector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateDetector]
$creadListPrec :: ReadPrec [BatchUpdateDetector]
readPrec :: ReadPrec BatchUpdateDetector
$creadPrec :: ReadPrec BatchUpdateDetector
readList :: ReadS [BatchUpdateDetector]
$creadList :: ReadS [BatchUpdateDetector]
readsPrec :: Int -> ReadS BatchUpdateDetector
$creadsPrec :: Int -> ReadS BatchUpdateDetector
Prelude.Read, Int -> BatchUpdateDetector -> ShowS
[BatchUpdateDetector] -> ShowS
BatchUpdateDetector -> String
(Int -> BatchUpdateDetector -> ShowS)
-> (BatchUpdateDetector -> String)
-> ([BatchUpdateDetector] -> ShowS)
-> Show BatchUpdateDetector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateDetector] -> ShowS
$cshowList :: [BatchUpdateDetector] -> ShowS
show :: BatchUpdateDetector -> String
$cshow :: BatchUpdateDetector -> String
showsPrec :: Int -> BatchUpdateDetector -> ShowS
$cshowsPrec :: Int -> BatchUpdateDetector -> ShowS
Prelude.Show, (forall x. BatchUpdateDetector -> Rep BatchUpdateDetector x)
-> (forall x. Rep BatchUpdateDetector x -> BatchUpdateDetector)
-> Generic BatchUpdateDetector
forall x. Rep BatchUpdateDetector x -> BatchUpdateDetector
forall x. BatchUpdateDetector -> Rep BatchUpdateDetector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchUpdateDetector x -> BatchUpdateDetector
$cfrom :: forall x. BatchUpdateDetector -> Rep BatchUpdateDetector x
Prelude.Generic)
newBatchUpdateDetector ::
Prelude.NonEmpty UpdateDetectorRequest ->
BatchUpdateDetector
newBatchUpdateDetector :: NonEmpty UpdateDetectorRequest -> BatchUpdateDetector
newBatchUpdateDetector NonEmpty UpdateDetectorRequest
pDetectors_ =
BatchUpdateDetector' :: NonEmpty UpdateDetectorRequest -> BatchUpdateDetector
BatchUpdateDetector'
{ $sel:detectors:BatchUpdateDetector' :: NonEmpty UpdateDetectorRequest
detectors =
Tagged
(NonEmpty UpdateDetectorRequest)
(Identity (NonEmpty UpdateDetectorRequest))
-> Tagged
(NonEmpty UpdateDetectorRequest)
(Identity (NonEmpty UpdateDetectorRequest))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty UpdateDetectorRequest)
(Identity (NonEmpty UpdateDetectorRequest))
-> Tagged
(NonEmpty UpdateDetectorRequest)
(Identity (NonEmpty UpdateDetectorRequest)))
-> NonEmpty UpdateDetectorRequest -> NonEmpty UpdateDetectorRequest
forall t b. AReview t b -> b -> t
Lens.# NonEmpty UpdateDetectorRequest
pDetectors_
}
batchUpdateDetector_detectors :: Lens.Lens' BatchUpdateDetector (Prelude.NonEmpty UpdateDetectorRequest)
batchUpdateDetector_detectors :: (NonEmpty UpdateDetectorRequest
-> f (NonEmpty UpdateDetectorRequest))
-> BatchUpdateDetector -> f BatchUpdateDetector
batchUpdateDetector_detectors = (BatchUpdateDetector -> NonEmpty UpdateDetectorRequest)
-> (BatchUpdateDetector
-> NonEmpty UpdateDetectorRequest -> BatchUpdateDetector)
-> Lens
BatchUpdateDetector
BatchUpdateDetector
(NonEmpty UpdateDetectorRequest)
(NonEmpty UpdateDetectorRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDetector' {NonEmpty UpdateDetectorRequest
detectors :: NonEmpty UpdateDetectorRequest
$sel:detectors:BatchUpdateDetector' :: BatchUpdateDetector -> NonEmpty UpdateDetectorRequest
detectors} -> NonEmpty UpdateDetectorRequest
detectors) (\s :: BatchUpdateDetector
s@BatchUpdateDetector' {} NonEmpty UpdateDetectorRequest
a -> BatchUpdateDetector
s {$sel:detectors:BatchUpdateDetector' :: NonEmpty UpdateDetectorRequest
detectors = NonEmpty UpdateDetectorRequest
a} :: BatchUpdateDetector) ((NonEmpty UpdateDetectorRequest
-> f (NonEmpty UpdateDetectorRequest))
-> BatchUpdateDetector -> f BatchUpdateDetector)
-> ((NonEmpty UpdateDetectorRequest
-> f (NonEmpty UpdateDetectorRequest))
-> NonEmpty UpdateDetectorRequest
-> f (NonEmpty UpdateDetectorRequest))
-> (NonEmpty UpdateDetectorRequest
-> f (NonEmpty UpdateDetectorRequest))
-> BatchUpdateDetector
-> f BatchUpdateDetector
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty UpdateDetectorRequest
-> f (NonEmpty UpdateDetectorRequest))
-> NonEmpty UpdateDetectorRequest
-> f (NonEmpty UpdateDetectorRequest)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchUpdateDetector where
type
AWSResponse BatchUpdateDetector =
BatchUpdateDetectorResponse
request :: BatchUpdateDetector -> Request BatchUpdateDetector
request = Service -> BatchUpdateDetector -> Request BatchUpdateDetector
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchUpdateDetector
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUpdateDetector)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchUpdateDetector))
-> Logger
-> Service
-> Proxy BatchUpdateDetector
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUpdateDetector)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [BatchUpdateDetectorErrorEntry]
-> Int -> BatchUpdateDetectorResponse
BatchUpdateDetectorResponse'
(Maybe [BatchUpdateDetectorErrorEntry]
-> Int -> BatchUpdateDetectorResponse)
-> Either String (Maybe [BatchUpdateDetectorErrorEntry])
-> Either String (Int -> BatchUpdateDetectorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Key
-> Either String (Maybe (Maybe [BatchUpdateDetectorErrorEntry]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"batchUpdateDetectorErrorEntries"
Either String (Maybe (Maybe [BatchUpdateDetectorErrorEntry]))
-> Maybe [BatchUpdateDetectorErrorEntry]
-> Either String (Maybe [BatchUpdateDetectorErrorEntry])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BatchUpdateDetectorErrorEntry]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> BatchUpdateDetectorResponse)
-> Either String Int -> Either String BatchUpdateDetectorResponse
forall (f :: * -> *) a b. Applicative f => 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 BatchUpdateDetector
instance Prelude.NFData BatchUpdateDetector
instance Core.ToHeaders BatchUpdateDetector where
toHeaders :: BatchUpdateDetector -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchUpdateDetector -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON BatchUpdateDetector where
toJSON :: BatchUpdateDetector -> Value
toJSON BatchUpdateDetector' {NonEmpty UpdateDetectorRequest
detectors :: NonEmpty UpdateDetectorRequest
$sel:detectors:BatchUpdateDetector' :: BatchUpdateDetector -> NonEmpty UpdateDetectorRequest
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Key
"detectors" Key -> NonEmpty UpdateDetectorRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= NonEmpty UpdateDetectorRequest
detectors)]
)
instance Core.ToPath BatchUpdateDetector where
toPath :: BatchUpdateDetector -> ByteString
toPath = ByteString -> BatchUpdateDetector -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/detectors"
instance Core.ToQuery BatchUpdateDetector where
toQuery :: BatchUpdateDetector -> QueryString
toQuery = QueryString -> BatchUpdateDetector -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchUpdateDetectorResponse = BatchUpdateDetectorResponse'
{
BatchUpdateDetectorResponse
-> Maybe [BatchUpdateDetectorErrorEntry]
batchUpdateDetectorErrorEntries :: Prelude.Maybe [BatchUpdateDetectorErrorEntry],
BatchUpdateDetectorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchUpdateDetectorResponse -> BatchUpdateDetectorResponse -> Bool
(BatchUpdateDetectorResponse
-> BatchUpdateDetectorResponse -> Bool)
-> (BatchUpdateDetectorResponse
-> BatchUpdateDetectorResponse -> Bool)
-> Eq BatchUpdateDetectorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateDetectorResponse -> BatchUpdateDetectorResponse -> Bool
$c/= :: BatchUpdateDetectorResponse -> BatchUpdateDetectorResponse -> Bool
== :: BatchUpdateDetectorResponse -> BatchUpdateDetectorResponse -> Bool
$c== :: BatchUpdateDetectorResponse -> BatchUpdateDetectorResponse -> Bool
Prelude.Eq, ReadPrec [BatchUpdateDetectorResponse]
ReadPrec BatchUpdateDetectorResponse
Int -> ReadS BatchUpdateDetectorResponse
ReadS [BatchUpdateDetectorResponse]
(Int -> ReadS BatchUpdateDetectorResponse)
-> ReadS [BatchUpdateDetectorResponse]
-> ReadPrec BatchUpdateDetectorResponse
-> ReadPrec [BatchUpdateDetectorResponse]
-> Read BatchUpdateDetectorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateDetectorResponse]
$creadListPrec :: ReadPrec [BatchUpdateDetectorResponse]
readPrec :: ReadPrec BatchUpdateDetectorResponse
$creadPrec :: ReadPrec BatchUpdateDetectorResponse
readList :: ReadS [BatchUpdateDetectorResponse]
$creadList :: ReadS [BatchUpdateDetectorResponse]
readsPrec :: Int -> ReadS BatchUpdateDetectorResponse
$creadsPrec :: Int -> ReadS BatchUpdateDetectorResponse
Prelude.Read, Int -> BatchUpdateDetectorResponse -> ShowS
[BatchUpdateDetectorResponse] -> ShowS
BatchUpdateDetectorResponse -> String
(Int -> BatchUpdateDetectorResponse -> ShowS)
-> (BatchUpdateDetectorResponse -> String)
-> ([BatchUpdateDetectorResponse] -> ShowS)
-> Show BatchUpdateDetectorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateDetectorResponse] -> ShowS
$cshowList :: [BatchUpdateDetectorResponse] -> ShowS
show :: BatchUpdateDetectorResponse -> String
$cshow :: BatchUpdateDetectorResponse -> String
showsPrec :: Int -> BatchUpdateDetectorResponse -> ShowS
$cshowsPrec :: Int -> BatchUpdateDetectorResponse -> ShowS
Prelude.Show, (forall x.
BatchUpdateDetectorResponse -> Rep BatchUpdateDetectorResponse x)
-> (forall x.
Rep BatchUpdateDetectorResponse x -> BatchUpdateDetectorResponse)
-> Generic BatchUpdateDetectorResponse
forall x.
Rep BatchUpdateDetectorResponse x -> BatchUpdateDetectorResponse
forall x.
BatchUpdateDetectorResponse -> Rep BatchUpdateDetectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdateDetectorResponse x -> BatchUpdateDetectorResponse
$cfrom :: forall x.
BatchUpdateDetectorResponse -> Rep BatchUpdateDetectorResponse x
Prelude.Generic)
newBatchUpdateDetectorResponse ::
Prelude.Int ->
BatchUpdateDetectorResponse
newBatchUpdateDetectorResponse :: Int -> BatchUpdateDetectorResponse
newBatchUpdateDetectorResponse Int
pHttpStatus_ =
BatchUpdateDetectorResponse' :: Maybe [BatchUpdateDetectorErrorEntry]
-> Int -> BatchUpdateDetectorResponse
BatchUpdateDetectorResponse'
{ $sel:batchUpdateDetectorErrorEntries:BatchUpdateDetectorResponse' :: Maybe [BatchUpdateDetectorErrorEntry]
batchUpdateDetectorErrorEntries =
Maybe [BatchUpdateDetectorErrorEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchUpdateDetectorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchUpdateDetectorResponse_batchUpdateDetectorErrorEntries :: Lens.Lens' BatchUpdateDetectorResponse (Prelude.Maybe [BatchUpdateDetectorErrorEntry])
batchUpdateDetectorResponse_batchUpdateDetectorErrorEntries :: (Maybe [BatchUpdateDetectorErrorEntry]
-> f (Maybe [BatchUpdateDetectorErrorEntry]))
-> BatchUpdateDetectorResponse -> f BatchUpdateDetectorResponse
batchUpdateDetectorResponse_batchUpdateDetectorErrorEntries = (BatchUpdateDetectorResponse
-> Maybe [BatchUpdateDetectorErrorEntry])
-> (BatchUpdateDetectorResponse
-> Maybe [BatchUpdateDetectorErrorEntry]
-> BatchUpdateDetectorResponse)
-> Lens
BatchUpdateDetectorResponse
BatchUpdateDetectorResponse
(Maybe [BatchUpdateDetectorErrorEntry])
(Maybe [BatchUpdateDetectorErrorEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDetectorResponse' {Maybe [BatchUpdateDetectorErrorEntry]
batchUpdateDetectorErrorEntries :: Maybe [BatchUpdateDetectorErrorEntry]
$sel:batchUpdateDetectorErrorEntries:BatchUpdateDetectorResponse' :: BatchUpdateDetectorResponse
-> Maybe [BatchUpdateDetectorErrorEntry]
batchUpdateDetectorErrorEntries} -> Maybe [BatchUpdateDetectorErrorEntry]
batchUpdateDetectorErrorEntries) (\s :: BatchUpdateDetectorResponse
s@BatchUpdateDetectorResponse' {} Maybe [BatchUpdateDetectorErrorEntry]
a -> BatchUpdateDetectorResponse
s {$sel:batchUpdateDetectorErrorEntries:BatchUpdateDetectorResponse' :: Maybe [BatchUpdateDetectorErrorEntry]
batchUpdateDetectorErrorEntries = Maybe [BatchUpdateDetectorErrorEntry]
a} :: BatchUpdateDetectorResponse) ((Maybe [BatchUpdateDetectorErrorEntry]
-> f (Maybe [BatchUpdateDetectorErrorEntry]))
-> BatchUpdateDetectorResponse -> f BatchUpdateDetectorResponse)
-> ((Maybe [BatchUpdateDetectorErrorEntry]
-> f (Maybe [BatchUpdateDetectorErrorEntry]))
-> Maybe [BatchUpdateDetectorErrorEntry]
-> f (Maybe [BatchUpdateDetectorErrorEntry]))
-> (Maybe [BatchUpdateDetectorErrorEntry]
-> f (Maybe [BatchUpdateDetectorErrorEntry]))
-> BatchUpdateDetectorResponse
-> f BatchUpdateDetectorResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[BatchUpdateDetectorErrorEntry]
[BatchUpdateDetectorErrorEntry]
[BatchUpdateDetectorErrorEntry]
[BatchUpdateDetectorErrorEntry]
-> Iso
(Maybe [BatchUpdateDetectorErrorEntry])
(Maybe [BatchUpdateDetectorErrorEntry])
(Maybe [BatchUpdateDetectorErrorEntry])
(Maybe [BatchUpdateDetectorErrorEntry])
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 AnIso
[BatchUpdateDetectorErrorEntry]
[BatchUpdateDetectorErrorEntry]
[BatchUpdateDetectorErrorEntry]
[BatchUpdateDetectorErrorEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchUpdateDetectorResponse_httpStatus :: Lens.Lens' BatchUpdateDetectorResponse Prelude.Int
batchUpdateDetectorResponse_httpStatus :: (Int -> f Int)
-> BatchUpdateDetectorResponse -> f BatchUpdateDetectorResponse
batchUpdateDetectorResponse_httpStatus = (BatchUpdateDetectorResponse -> Int)
-> (BatchUpdateDetectorResponse
-> Int -> BatchUpdateDetectorResponse)
-> Lens
BatchUpdateDetectorResponse BatchUpdateDetectorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDetectorResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchUpdateDetectorResponse' :: BatchUpdateDetectorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchUpdateDetectorResponse
s@BatchUpdateDetectorResponse' {} Int
a -> BatchUpdateDetectorResponse
s {$sel:httpStatus:BatchUpdateDetectorResponse' :: Int
httpStatus = Int
a} :: BatchUpdateDetectorResponse)
instance Prelude.NFData BatchUpdateDetectorResponse