{-# 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.BatchEnableAlarm
(
BatchEnableAlarm (..),
newBatchEnableAlarm,
batchEnableAlarm_enableActionRequests,
BatchEnableAlarmResponse (..),
newBatchEnableAlarmResponse,
batchEnableAlarmResponse_errorEntries,
batchEnableAlarmResponse_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 BatchEnableAlarm = BatchEnableAlarm'
{
BatchEnableAlarm -> NonEmpty EnableAlarmActionRequest
enableActionRequests :: Prelude.NonEmpty EnableAlarmActionRequest
}
deriving (BatchEnableAlarm -> BatchEnableAlarm -> Bool
(BatchEnableAlarm -> BatchEnableAlarm -> Bool)
-> (BatchEnableAlarm -> BatchEnableAlarm -> Bool)
-> Eq BatchEnableAlarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchEnableAlarm -> BatchEnableAlarm -> Bool
$c/= :: BatchEnableAlarm -> BatchEnableAlarm -> Bool
== :: BatchEnableAlarm -> BatchEnableAlarm -> Bool
$c== :: BatchEnableAlarm -> BatchEnableAlarm -> Bool
Prelude.Eq, ReadPrec [BatchEnableAlarm]
ReadPrec BatchEnableAlarm
Int -> ReadS BatchEnableAlarm
ReadS [BatchEnableAlarm]
(Int -> ReadS BatchEnableAlarm)
-> ReadS [BatchEnableAlarm]
-> ReadPrec BatchEnableAlarm
-> ReadPrec [BatchEnableAlarm]
-> Read BatchEnableAlarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchEnableAlarm]
$creadListPrec :: ReadPrec [BatchEnableAlarm]
readPrec :: ReadPrec BatchEnableAlarm
$creadPrec :: ReadPrec BatchEnableAlarm
readList :: ReadS [BatchEnableAlarm]
$creadList :: ReadS [BatchEnableAlarm]
readsPrec :: Int -> ReadS BatchEnableAlarm
$creadsPrec :: Int -> ReadS BatchEnableAlarm
Prelude.Read, Int -> BatchEnableAlarm -> ShowS
[BatchEnableAlarm] -> ShowS
BatchEnableAlarm -> String
(Int -> BatchEnableAlarm -> ShowS)
-> (BatchEnableAlarm -> String)
-> ([BatchEnableAlarm] -> ShowS)
-> Show BatchEnableAlarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchEnableAlarm] -> ShowS
$cshowList :: [BatchEnableAlarm] -> ShowS
show :: BatchEnableAlarm -> String
$cshow :: BatchEnableAlarm -> String
showsPrec :: Int -> BatchEnableAlarm -> ShowS
$cshowsPrec :: Int -> BatchEnableAlarm -> ShowS
Prelude.Show, (forall x. BatchEnableAlarm -> Rep BatchEnableAlarm x)
-> (forall x. Rep BatchEnableAlarm x -> BatchEnableAlarm)
-> Generic BatchEnableAlarm
forall x. Rep BatchEnableAlarm x -> BatchEnableAlarm
forall x. BatchEnableAlarm -> Rep BatchEnableAlarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchEnableAlarm x -> BatchEnableAlarm
$cfrom :: forall x. BatchEnableAlarm -> Rep BatchEnableAlarm x
Prelude.Generic)
newBatchEnableAlarm ::
Prelude.NonEmpty EnableAlarmActionRequest ->
BatchEnableAlarm
newBatchEnableAlarm :: NonEmpty EnableAlarmActionRequest -> BatchEnableAlarm
newBatchEnableAlarm NonEmpty EnableAlarmActionRequest
pEnableActionRequests_ =
BatchEnableAlarm' :: NonEmpty EnableAlarmActionRequest -> BatchEnableAlarm
BatchEnableAlarm'
{ $sel:enableActionRequests:BatchEnableAlarm' :: NonEmpty EnableAlarmActionRequest
enableActionRequests =
Tagged
(NonEmpty EnableAlarmActionRequest)
(Identity (NonEmpty EnableAlarmActionRequest))
-> Tagged
(NonEmpty EnableAlarmActionRequest)
(Identity (NonEmpty EnableAlarmActionRequest))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty EnableAlarmActionRequest)
(Identity (NonEmpty EnableAlarmActionRequest))
-> Tagged
(NonEmpty EnableAlarmActionRequest)
(Identity (NonEmpty EnableAlarmActionRequest)))
-> NonEmpty EnableAlarmActionRequest
-> NonEmpty EnableAlarmActionRequest
forall t b. AReview t b -> b -> t
Lens.# NonEmpty EnableAlarmActionRequest
pEnableActionRequests_
}
batchEnableAlarm_enableActionRequests :: Lens.Lens' BatchEnableAlarm (Prelude.NonEmpty EnableAlarmActionRequest)
batchEnableAlarm_enableActionRequests :: (NonEmpty EnableAlarmActionRequest
-> f (NonEmpty EnableAlarmActionRequest))
-> BatchEnableAlarm -> f BatchEnableAlarm
batchEnableAlarm_enableActionRequests = (BatchEnableAlarm -> NonEmpty EnableAlarmActionRequest)
-> (BatchEnableAlarm
-> NonEmpty EnableAlarmActionRequest -> BatchEnableAlarm)
-> Lens
BatchEnableAlarm
BatchEnableAlarm
(NonEmpty EnableAlarmActionRequest)
(NonEmpty EnableAlarmActionRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEnableAlarm' {NonEmpty EnableAlarmActionRequest
enableActionRequests :: NonEmpty EnableAlarmActionRequest
$sel:enableActionRequests:BatchEnableAlarm' :: BatchEnableAlarm -> NonEmpty EnableAlarmActionRequest
enableActionRequests} -> NonEmpty EnableAlarmActionRequest
enableActionRequests) (\s :: BatchEnableAlarm
s@BatchEnableAlarm' {} NonEmpty EnableAlarmActionRequest
a -> BatchEnableAlarm
s {$sel:enableActionRequests:BatchEnableAlarm' :: NonEmpty EnableAlarmActionRequest
enableActionRequests = NonEmpty EnableAlarmActionRequest
a} :: BatchEnableAlarm) ((NonEmpty EnableAlarmActionRequest
-> f (NonEmpty EnableAlarmActionRequest))
-> BatchEnableAlarm -> f BatchEnableAlarm)
-> ((NonEmpty EnableAlarmActionRequest
-> f (NonEmpty EnableAlarmActionRequest))
-> NonEmpty EnableAlarmActionRequest
-> f (NonEmpty EnableAlarmActionRequest))
-> (NonEmpty EnableAlarmActionRequest
-> f (NonEmpty EnableAlarmActionRequest))
-> BatchEnableAlarm
-> f BatchEnableAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty EnableAlarmActionRequest
-> f (NonEmpty EnableAlarmActionRequest))
-> NonEmpty EnableAlarmActionRequest
-> f (NonEmpty EnableAlarmActionRequest)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchEnableAlarm where
type
AWSResponse BatchEnableAlarm =
BatchEnableAlarmResponse
request :: BatchEnableAlarm -> Request BatchEnableAlarm
request = Service -> BatchEnableAlarm -> Request BatchEnableAlarm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchEnableAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchEnableAlarm)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchEnableAlarm))
-> Logger
-> Service
-> Proxy BatchEnableAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchEnableAlarm)))
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 [BatchAlarmActionErrorEntry]
-> Int -> BatchEnableAlarmResponse
BatchEnableAlarmResponse'
(Maybe [BatchAlarmActionErrorEntry]
-> Int -> BatchEnableAlarmResponse)
-> Either String (Maybe [BatchAlarmActionErrorEntry])
-> Either String (Int -> BatchEnableAlarmResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Key
-> Either String (Maybe (Maybe [BatchAlarmActionErrorEntry]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"errorEntries" Either String (Maybe (Maybe [BatchAlarmActionErrorEntry]))
-> Maybe [BatchAlarmActionErrorEntry]
-> Either String (Maybe [BatchAlarmActionErrorEntry])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BatchAlarmActionErrorEntry]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchEnableAlarmResponse)
-> Either String Int -> Either String BatchEnableAlarmResponse
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 BatchEnableAlarm
instance Prelude.NFData BatchEnableAlarm
instance Core.ToHeaders BatchEnableAlarm where
toHeaders :: BatchEnableAlarm -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchEnableAlarm -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON BatchEnableAlarm where
toJSON :: BatchEnableAlarm -> Value
toJSON BatchEnableAlarm' {NonEmpty EnableAlarmActionRequest
enableActionRequests :: NonEmpty EnableAlarmActionRequest
$sel:enableActionRequests:BatchEnableAlarm' :: BatchEnableAlarm -> NonEmpty EnableAlarmActionRequest
..} =
[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
"enableActionRequests"
Key -> NonEmpty EnableAlarmActionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= NonEmpty EnableAlarmActionRequest
enableActionRequests
)
]
)
instance Core.ToPath BatchEnableAlarm where
toPath :: BatchEnableAlarm -> ByteString
toPath = ByteString -> BatchEnableAlarm -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/alarms/enable"
instance Core.ToQuery BatchEnableAlarm where
toQuery :: BatchEnableAlarm -> QueryString
toQuery = QueryString -> BatchEnableAlarm -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchEnableAlarmResponse = BatchEnableAlarmResponse'
{
BatchEnableAlarmResponse -> Maybe [BatchAlarmActionErrorEntry]
errorEntries :: Prelude.Maybe [BatchAlarmActionErrorEntry],
BatchEnableAlarmResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchEnableAlarmResponse -> BatchEnableAlarmResponse -> Bool
(BatchEnableAlarmResponse -> BatchEnableAlarmResponse -> Bool)
-> (BatchEnableAlarmResponse -> BatchEnableAlarmResponse -> Bool)
-> Eq BatchEnableAlarmResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchEnableAlarmResponse -> BatchEnableAlarmResponse -> Bool
$c/= :: BatchEnableAlarmResponse -> BatchEnableAlarmResponse -> Bool
== :: BatchEnableAlarmResponse -> BatchEnableAlarmResponse -> Bool
$c== :: BatchEnableAlarmResponse -> BatchEnableAlarmResponse -> Bool
Prelude.Eq, ReadPrec [BatchEnableAlarmResponse]
ReadPrec BatchEnableAlarmResponse
Int -> ReadS BatchEnableAlarmResponse
ReadS [BatchEnableAlarmResponse]
(Int -> ReadS BatchEnableAlarmResponse)
-> ReadS [BatchEnableAlarmResponse]
-> ReadPrec BatchEnableAlarmResponse
-> ReadPrec [BatchEnableAlarmResponse]
-> Read BatchEnableAlarmResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchEnableAlarmResponse]
$creadListPrec :: ReadPrec [BatchEnableAlarmResponse]
readPrec :: ReadPrec BatchEnableAlarmResponse
$creadPrec :: ReadPrec BatchEnableAlarmResponse
readList :: ReadS [BatchEnableAlarmResponse]
$creadList :: ReadS [BatchEnableAlarmResponse]
readsPrec :: Int -> ReadS BatchEnableAlarmResponse
$creadsPrec :: Int -> ReadS BatchEnableAlarmResponse
Prelude.Read, Int -> BatchEnableAlarmResponse -> ShowS
[BatchEnableAlarmResponse] -> ShowS
BatchEnableAlarmResponse -> String
(Int -> BatchEnableAlarmResponse -> ShowS)
-> (BatchEnableAlarmResponse -> String)
-> ([BatchEnableAlarmResponse] -> ShowS)
-> Show BatchEnableAlarmResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchEnableAlarmResponse] -> ShowS
$cshowList :: [BatchEnableAlarmResponse] -> ShowS
show :: BatchEnableAlarmResponse -> String
$cshow :: BatchEnableAlarmResponse -> String
showsPrec :: Int -> BatchEnableAlarmResponse -> ShowS
$cshowsPrec :: Int -> BatchEnableAlarmResponse -> ShowS
Prelude.Show, (forall x.
BatchEnableAlarmResponse -> Rep BatchEnableAlarmResponse x)
-> (forall x.
Rep BatchEnableAlarmResponse x -> BatchEnableAlarmResponse)
-> Generic BatchEnableAlarmResponse
forall x.
Rep BatchEnableAlarmResponse x -> BatchEnableAlarmResponse
forall x.
BatchEnableAlarmResponse -> Rep BatchEnableAlarmResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchEnableAlarmResponse x -> BatchEnableAlarmResponse
$cfrom :: forall x.
BatchEnableAlarmResponse -> Rep BatchEnableAlarmResponse x
Prelude.Generic)
newBatchEnableAlarmResponse ::
Prelude.Int ->
BatchEnableAlarmResponse
newBatchEnableAlarmResponse :: Int -> BatchEnableAlarmResponse
newBatchEnableAlarmResponse Int
pHttpStatus_ =
BatchEnableAlarmResponse' :: Maybe [BatchAlarmActionErrorEntry]
-> Int -> BatchEnableAlarmResponse
BatchEnableAlarmResponse'
{ $sel:errorEntries:BatchEnableAlarmResponse' :: Maybe [BatchAlarmActionErrorEntry]
errorEntries =
Maybe [BatchAlarmActionErrorEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchEnableAlarmResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchEnableAlarmResponse_errorEntries :: Lens.Lens' BatchEnableAlarmResponse (Prelude.Maybe [BatchAlarmActionErrorEntry])
batchEnableAlarmResponse_errorEntries :: (Maybe [BatchAlarmActionErrorEntry]
-> f (Maybe [BatchAlarmActionErrorEntry]))
-> BatchEnableAlarmResponse -> f BatchEnableAlarmResponse
batchEnableAlarmResponse_errorEntries = (BatchEnableAlarmResponse -> Maybe [BatchAlarmActionErrorEntry])
-> (BatchEnableAlarmResponse
-> Maybe [BatchAlarmActionErrorEntry] -> BatchEnableAlarmResponse)
-> Lens
BatchEnableAlarmResponse
BatchEnableAlarmResponse
(Maybe [BatchAlarmActionErrorEntry])
(Maybe [BatchAlarmActionErrorEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEnableAlarmResponse' {Maybe [BatchAlarmActionErrorEntry]
errorEntries :: Maybe [BatchAlarmActionErrorEntry]
$sel:errorEntries:BatchEnableAlarmResponse' :: BatchEnableAlarmResponse -> Maybe [BatchAlarmActionErrorEntry]
errorEntries} -> Maybe [BatchAlarmActionErrorEntry]
errorEntries) (\s :: BatchEnableAlarmResponse
s@BatchEnableAlarmResponse' {} Maybe [BatchAlarmActionErrorEntry]
a -> BatchEnableAlarmResponse
s {$sel:errorEntries:BatchEnableAlarmResponse' :: Maybe [BatchAlarmActionErrorEntry]
errorEntries = Maybe [BatchAlarmActionErrorEntry]
a} :: BatchEnableAlarmResponse) ((Maybe [BatchAlarmActionErrorEntry]
-> f (Maybe [BatchAlarmActionErrorEntry]))
-> BatchEnableAlarmResponse -> f BatchEnableAlarmResponse)
-> ((Maybe [BatchAlarmActionErrorEntry]
-> f (Maybe [BatchAlarmActionErrorEntry]))
-> Maybe [BatchAlarmActionErrorEntry]
-> f (Maybe [BatchAlarmActionErrorEntry]))
-> (Maybe [BatchAlarmActionErrorEntry]
-> f (Maybe [BatchAlarmActionErrorEntry]))
-> BatchEnableAlarmResponse
-> f BatchEnableAlarmResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[BatchAlarmActionErrorEntry]
[BatchAlarmActionErrorEntry]
[BatchAlarmActionErrorEntry]
[BatchAlarmActionErrorEntry]
-> Iso
(Maybe [BatchAlarmActionErrorEntry])
(Maybe [BatchAlarmActionErrorEntry])
(Maybe [BatchAlarmActionErrorEntry])
(Maybe [BatchAlarmActionErrorEntry])
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
[BatchAlarmActionErrorEntry]
[BatchAlarmActionErrorEntry]
[BatchAlarmActionErrorEntry]
[BatchAlarmActionErrorEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchEnableAlarmResponse_httpStatus :: Lens.Lens' BatchEnableAlarmResponse Prelude.Int
batchEnableAlarmResponse_httpStatus :: (Int -> f Int)
-> BatchEnableAlarmResponse -> f BatchEnableAlarmResponse
batchEnableAlarmResponse_httpStatus = (BatchEnableAlarmResponse -> Int)
-> (BatchEnableAlarmResponse -> Int -> BatchEnableAlarmResponse)
-> Lens BatchEnableAlarmResponse BatchEnableAlarmResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEnableAlarmResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchEnableAlarmResponse' :: BatchEnableAlarmResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchEnableAlarmResponse
s@BatchEnableAlarmResponse' {} Int
a -> BatchEnableAlarmResponse
s {$sel:httpStatus:BatchEnableAlarmResponse' :: Int
httpStatus = Int
a} :: BatchEnableAlarmResponse)
instance Prelude.NFData BatchEnableAlarmResponse