{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudWatch.EnableAlarmActions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Enables the actions for the specified alarms.
module Amazonka.CloudWatch.EnableAlarmActions
  ( -- * Creating a Request
    EnableAlarmActions (..),
    newEnableAlarmActions,

    -- * Request Lenses
    enableAlarmActions_alarmNames,

    -- * Destructuring the Response
    EnableAlarmActionsResponse (..),
    newEnableAlarmActionsResponse,
  )
where

import Amazonka.CloudWatch.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newEnableAlarmActions' smart constructor.
data EnableAlarmActions = EnableAlarmActions'
  { -- | The names of the alarms.
    EnableAlarmActions -> [Text]
alarmNames :: [Prelude.Text]
  }
  deriving (EnableAlarmActions -> EnableAlarmActions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableAlarmActions -> EnableAlarmActions -> Bool
$c/= :: EnableAlarmActions -> EnableAlarmActions -> Bool
== :: EnableAlarmActions -> EnableAlarmActions -> Bool
$c== :: EnableAlarmActions -> EnableAlarmActions -> Bool
Prelude.Eq, ReadPrec [EnableAlarmActions]
ReadPrec EnableAlarmActions
Int -> ReadS EnableAlarmActions
ReadS [EnableAlarmActions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableAlarmActions]
$creadListPrec :: ReadPrec [EnableAlarmActions]
readPrec :: ReadPrec EnableAlarmActions
$creadPrec :: ReadPrec EnableAlarmActions
readList :: ReadS [EnableAlarmActions]
$creadList :: ReadS [EnableAlarmActions]
readsPrec :: Int -> ReadS EnableAlarmActions
$creadsPrec :: Int -> ReadS EnableAlarmActions
Prelude.Read, Int -> EnableAlarmActions -> ShowS
[EnableAlarmActions] -> ShowS
EnableAlarmActions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableAlarmActions] -> ShowS
$cshowList :: [EnableAlarmActions] -> ShowS
show :: EnableAlarmActions -> String
$cshow :: EnableAlarmActions -> String
showsPrec :: Int -> EnableAlarmActions -> ShowS
$cshowsPrec :: Int -> EnableAlarmActions -> ShowS
Prelude.Show, forall x. Rep EnableAlarmActions x -> EnableAlarmActions
forall x. EnableAlarmActions -> Rep EnableAlarmActions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableAlarmActions x -> EnableAlarmActions
$cfrom :: forall x. EnableAlarmActions -> Rep EnableAlarmActions x
Prelude.Generic)

-- |
-- Create a value of 'EnableAlarmActions' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'alarmNames', 'enableAlarmActions_alarmNames' - The names of the alarms.
newEnableAlarmActions ::
  EnableAlarmActions
newEnableAlarmActions :: EnableAlarmActions
newEnableAlarmActions =
  EnableAlarmActions' {$sel:alarmNames:EnableAlarmActions' :: [Text]
alarmNames = forall a. Monoid a => a
Prelude.mempty}

-- | The names of the alarms.
enableAlarmActions_alarmNames :: Lens.Lens' EnableAlarmActions [Prelude.Text]
enableAlarmActions_alarmNames :: Lens' EnableAlarmActions [Text]
enableAlarmActions_alarmNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAlarmActions' {[Text]
alarmNames :: [Text]
$sel:alarmNames:EnableAlarmActions' :: EnableAlarmActions -> [Text]
alarmNames} -> [Text]
alarmNames) (\s :: EnableAlarmActions
s@EnableAlarmActions' {} [Text]
a -> EnableAlarmActions
s {$sel:alarmNames:EnableAlarmActions' :: [Text]
alarmNames = [Text]
a} :: EnableAlarmActions) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest EnableAlarmActions where
  type
    AWSResponse EnableAlarmActions =
      EnableAlarmActionsResponse
  request :: (Service -> Service)
-> EnableAlarmActions -> Request EnableAlarmActions
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy EnableAlarmActions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse EnableAlarmActions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull EnableAlarmActionsResponse
EnableAlarmActionsResponse'

instance Prelude.Hashable EnableAlarmActions where
  hashWithSalt :: Int -> EnableAlarmActions -> Int
hashWithSalt Int
_salt EnableAlarmActions' {[Text]
alarmNames :: [Text]
$sel:alarmNames:EnableAlarmActions' :: EnableAlarmActions -> [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
alarmNames

instance Prelude.NFData EnableAlarmActions where
  rnf :: EnableAlarmActions -> ()
rnf EnableAlarmActions' {[Text]
alarmNames :: [Text]
$sel:alarmNames:EnableAlarmActions' :: EnableAlarmActions -> [Text]
..} = forall a. NFData a => a -> ()
Prelude.rnf [Text]
alarmNames

instance Data.ToHeaders EnableAlarmActions where
  toHeaders :: EnableAlarmActions -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath EnableAlarmActions where
  toPath :: EnableAlarmActions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery EnableAlarmActions where
  toQuery :: EnableAlarmActions -> QueryString
toQuery EnableAlarmActions' {[Text]
alarmNames :: [Text]
$sel:alarmNames:EnableAlarmActions' :: EnableAlarmActions -> [Text]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"EnableAlarmActions" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"AlarmNames"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" [Text]
alarmNames
      ]

-- | /See:/ 'newEnableAlarmActionsResponse' smart constructor.
data EnableAlarmActionsResponse = EnableAlarmActionsResponse'
  {
  }
  deriving (EnableAlarmActionsResponse -> EnableAlarmActionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableAlarmActionsResponse -> EnableAlarmActionsResponse -> Bool
$c/= :: EnableAlarmActionsResponse -> EnableAlarmActionsResponse -> Bool
== :: EnableAlarmActionsResponse -> EnableAlarmActionsResponse -> Bool
$c== :: EnableAlarmActionsResponse -> EnableAlarmActionsResponse -> Bool
Prelude.Eq, ReadPrec [EnableAlarmActionsResponse]
ReadPrec EnableAlarmActionsResponse
Int -> ReadS EnableAlarmActionsResponse
ReadS [EnableAlarmActionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableAlarmActionsResponse]
$creadListPrec :: ReadPrec [EnableAlarmActionsResponse]
readPrec :: ReadPrec EnableAlarmActionsResponse
$creadPrec :: ReadPrec EnableAlarmActionsResponse
readList :: ReadS [EnableAlarmActionsResponse]
$creadList :: ReadS [EnableAlarmActionsResponse]
readsPrec :: Int -> ReadS EnableAlarmActionsResponse
$creadsPrec :: Int -> ReadS EnableAlarmActionsResponse
Prelude.Read, Int -> EnableAlarmActionsResponse -> ShowS
[EnableAlarmActionsResponse] -> ShowS
EnableAlarmActionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableAlarmActionsResponse] -> ShowS
$cshowList :: [EnableAlarmActionsResponse] -> ShowS
show :: EnableAlarmActionsResponse -> String
$cshow :: EnableAlarmActionsResponse -> String
showsPrec :: Int -> EnableAlarmActionsResponse -> ShowS
$cshowsPrec :: Int -> EnableAlarmActionsResponse -> ShowS
Prelude.Show, forall x.
Rep EnableAlarmActionsResponse x -> EnableAlarmActionsResponse
forall x.
EnableAlarmActionsResponse -> Rep EnableAlarmActionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableAlarmActionsResponse x -> EnableAlarmActionsResponse
$cfrom :: forall x.
EnableAlarmActionsResponse -> Rep EnableAlarmActionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'EnableAlarmActionsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newEnableAlarmActionsResponse ::
  EnableAlarmActionsResponse
newEnableAlarmActionsResponse :: EnableAlarmActionsResponse
newEnableAlarmActionsResponse =
  EnableAlarmActionsResponse
EnableAlarmActionsResponse'

instance Prelude.NFData EnableAlarmActionsResponse where
  rnf :: EnableAlarmActionsResponse -> ()
rnf EnableAlarmActionsResponse
_ = ()