{-# 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.Lightsail.DeleteAlarm
(
DeleteAlarm (..),
newDeleteAlarm,
deleteAlarm_alarmName,
DeleteAlarmResponse (..),
newDeleteAlarmResponse,
deleteAlarmResponse_operations,
deleteAlarmResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteAlarm = DeleteAlarm'
{
DeleteAlarm -> Text
alarmName :: Prelude.Text
}
deriving (DeleteAlarm -> DeleteAlarm -> Bool
(DeleteAlarm -> DeleteAlarm -> Bool)
-> (DeleteAlarm -> DeleteAlarm -> Bool) -> Eq DeleteAlarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAlarm -> DeleteAlarm -> Bool
$c/= :: DeleteAlarm -> DeleteAlarm -> Bool
== :: DeleteAlarm -> DeleteAlarm -> Bool
$c== :: DeleteAlarm -> DeleteAlarm -> Bool
Prelude.Eq, ReadPrec [DeleteAlarm]
ReadPrec DeleteAlarm
Int -> ReadS DeleteAlarm
ReadS [DeleteAlarm]
(Int -> ReadS DeleteAlarm)
-> ReadS [DeleteAlarm]
-> ReadPrec DeleteAlarm
-> ReadPrec [DeleteAlarm]
-> Read DeleteAlarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAlarm]
$creadListPrec :: ReadPrec [DeleteAlarm]
readPrec :: ReadPrec DeleteAlarm
$creadPrec :: ReadPrec DeleteAlarm
readList :: ReadS [DeleteAlarm]
$creadList :: ReadS [DeleteAlarm]
readsPrec :: Int -> ReadS DeleteAlarm
$creadsPrec :: Int -> ReadS DeleteAlarm
Prelude.Read, Int -> DeleteAlarm -> ShowS
[DeleteAlarm] -> ShowS
DeleteAlarm -> String
(Int -> DeleteAlarm -> ShowS)
-> (DeleteAlarm -> String)
-> ([DeleteAlarm] -> ShowS)
-> Show DeleteAlarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAlarm] -> ShowS
$cshowList :: [DeleteAlarm] -> ShowS
show :: DeleteAlarm -> String
$cshow :: DeleteAlarm -> String
showsPrec :: Int -> DeleteAlarm -> ShowS
$cshowsPrec :: Int -> DeleteAlarm -> ShowS
Prelude.Show, (forall x. DeleteAlarm -> Rep DeleteAlarm x)
-> (forall x. Rep DeleteAlarm x -> DeleteAlarm)
-> Generic DeleteAlarm
forall x. Rep DeleteAlarm x -> DeleteAlarm
forall x. DeleteAlarm -> Rep DeleteAlarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAlarm x -> DeleteAlarm
$cfrom :: forall x. DeleteAlarm -> Rep DeleteAlarm x
Prelude.Generic)
newDeleteAlarm ::
Prelude.Text ->
DeleteAlarm
newDeleteAlarm :: Text -> DeleteAlarm
newDeleteAlarm Text
pAlarmName_ =
DeleteAlarm' :: Text -> DeleteAlarm
DeleteAlarm' {$sel:alarmName:DeleteAlarm' :: Text
alarmName = Text
pAlarmName_}
deleteAlarm_alarmName :: Lens.Lens' DeleteAlarm Prelude.Text
deleteAlarm_alarmName :: (Text -> f Text) -> DeleteAlarm -> f DeleteAlarm
deleteAlarm_alarmName = (DeleteAlarm -> Text)
-> (DeleteAlarm -> Text -> DeleteAlarm)
-> Lens DeleteAlarm DeleteAlarm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAlarm' {Text
alarmName :: Text
$sel:alarmName:DeleteAlarm' :: DeleteAlarm -> Text
alarmName} -> Text
alarmName) (\s :: DeleteAlarm
s@DeleteAlarm' {} Text
a -> DeleteAlarm
s {$sel:alarmName:DeleteAlarm' :: Text
alarmName = Text
a} :: DeleteAlarm)
instance Core.AWSRequest DeleteAlarm where
type AWSResponse DeleteAlarm = DeleteAlarmResponse
request :: DeleteAlarm -> Request DeleteAlarm
request = Service -> DeleteAlarm -> Request DeleteAlarm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAlarm)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteAlarm))
-> Logger
-> Service
-> Proxy DeleteAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAlarm)))
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 [Operation] -> Int -> DeleteAlarmResponse
DeleteAlarmResponse'
(Maybe [Operation] -> Int -> DeleteAlarmResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> DeleteAlarmResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DeleteAlarmResponse)
-> Either String Int -> Either String DeleteAlarmResponse
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 DeleteAlarm
instance Prelude.NFData DeleteAlarm
instance Core.ToHeaders DeleteAlarm where
toHeaders :: DeleteAlarm -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteAlarm -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.DeleteAlarm" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DeleteAlarm where
toJSON :: DeleteAlarm -> Value
toJSON DeleteAlarm' {Text
alarmName :: Text
$sel:alarmName:DeleteAlarm' :: DeleteAlarm -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"alarmName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
alarmName)]
)
instance Core.ToPath DeleteAlarm where
toPath :: DeleteAlarm -> ByteString
toPath = ByteString -> DeleteAlarm -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteAlarm where
toQuery :: DeleteAlarm -> QueryString
toQuery = QueryString -> DeleteAlarm -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteAlarmResponse = DeleteAlarmResponse'
{
DeleteAlarmResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
DeleteAlarmResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteAlarmResponse -> DeleteAlarmResponse -> Bool
(DeleteAlarmResponse -> DeleteAlarmResponse -> Bool)
-> (DeleteAlarmResponse -> DeleteAlarmResponse -> Bool)
-> Eq DeleteAlarmResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAlarmResponse -> DeleteAlarmResponse -> Bool
$c/= :: DeleteAlarmResponse -> DeleteAlarmResponse -> Bool
== :: DeleteAlarmResponse -> DeleteAlarmResponse -> Bool
$c== :: DeleteAlarmResponse -> DeleteAlarmResponse -> Bool
Prelude.Eq, ReadPrec [DeleteAlarmResponse]
ReadPrec DeleteAlarmResponse
Int -> ReadS DeleteAlarmResponse
ReadS [DeleteAlarmResponse]
(Int -> ReadS DeleteAlarmResponse)
-> ReadS [DeleteAlarmResponse]
-> ReadPrec DeleteAlarmResponse
-> ReadPrec [DeleteAlarmResponse]
-> Read DeleteAlarmResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAlarmResponse]
$creadListPrec :: ReadPrec [DeleteAlarmResponse]
readPrec :: ReadPrec DeleteAlarmResponse
$creadPrec :: ReadPrec DeleteAlarmResponse
readList :: ReadS [DeleteAlarmResponse]
$creadList :: ReadS [DeleteAlarmResponse]
readsPrec :: Int -> ReadS DeleteAlarmResponse
$creadsPrec :: Int -> ReadS DeleteAlarmResponse
Prelude.Read, Int -> DeleteAlarmResponse -> ShowS
[DeleteAlarmResponse] -> ShowS
DeleteAlarmResponse -> String
(Int -> DeleteAlarmResponse -> ShowS)
-> (DeleteAlarmResponse -> String)
-> ([DeleteAlarmResponse] -> ShowS)
-> Show DeleteAlarmResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAlarmResponse] -> ShowS
$cshowList :: [DeleteAlarmResponse] -> ShowS
show :: DeleteAlarmResponse -> String
$cshow :: DeleteAlarmResponse -> String
showsPrec :: Int -> DeleteAlarmResponse -> ShowS
$cshowsPrec :: Int -> DeleteAlarmResponse -> ShowS
Prelude.Show, (forall x. DeleteAlarmResponse -> Rep DeleteAlarmResponse x)
-> (forall x. Rep DeleteAlarmResponse x -> DeleteAlarmResponse)
-> Generic DeleteAlarmResponse
forall x. Rep DeleteAlarmResponse x -> DeleteAlarmResponse
forall x. DeleteAlarmResponse -> Rep DeleteAlarmResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAlarmResponse x -> DeleteAlarmResponse
$cfrom :: forall x. DeleteAlarmResponse -> Rep DeleteAlarmResponse x
Prelude.Generic)
newDeleteAlarmResponse ::
Prelude.Int ->
DeleteAlarmResponse
newDeleteAlarmResponse :: Int -> DeleteAlarmResponse
newDeleteAlarmResponse Int
pHttpStatus_ =
DeleteAlarmResponse' :: Maybe [Operation] -> Int -> DeleteAlarmResponse
DeleteAlarmResponse'
{ $sel:operations:DeleteAlarmResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteAlarmResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteAlarmResponse_operations :: Lens.Lens' DeleteAlarmResponse (Prelude.Maybe [Operation])
deleteAlarmResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteAlarmResponse -> f DeleteAlarmResponse
deleteAlarmResponse_operations = (DeleteAlarmResponse -> Maybe [Operation])
-> (DeleteAlarmResponse
-> Maybe [Operation] -> DeleteAlarmResponse)
-> Lens
DeleteAlarmResponse
DeleteAlarmResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAlarmResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:DeleteAlarmResponse' :: DeleteAlarmResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: DeleteAlarmResponse
s@DeleteAlarmResponse' {} Maybe [Operation]
a -> DeleteAlarmResponse
s {$sel:operations:DeleteAlarmResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: DeleteAlarmResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteAlarmResponse -> f DeleteAlarmResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteAlarmResponse
-> f DeleteAlarmResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
deleteAlarmResponse_httpStatus :: Lens.Lens' DeleteAlarmResponse Prelude.Int
deleteAlarmResponse_httpStatus :: (Int -> f Int) -> DeleteAlarmResponse -> f DeleteAlarmResponse
deleteAlarmResponse_httpStatus = (DeleteAlarmResponse -> Int)
-> (DeleteAlarmResponse -> Int -> DeleteAlarmResponse)
-> Lens DeleteAlarmResponse DeleteAlarmResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAlarmResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteAlarmResponse' :: DeleteAlarmResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteAlarmResponse
s@DeleteAlarmResponse' {} Int
a -> DeleteAlarmResponse
s {$sel:httpStatus:DeleteAlarmResponse' :: Int
httpStatus = Int
a} :: DeleteAlarmResponse)
instance Prelude.NFData DeleteAlarmResponse