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