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