{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.Lens as Lens
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
(EnableAlarmActions -> EnableAlarmActions -> Bool)
-> (EnableAlarmActions -> EnableAlarmActions -> Bool)
-> Eq EnableAlarmActions
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]
(Int -> ReadS EnableAlarmActions)
-> ReadS [EnableAlarmActions]
-> ReadPrec EnableAlarmActions
-> ReadPrec [EnableAlarmActions]
-> Read 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
(Int -> EnableAlarmActions -> ShowS)
-> (EnableAlarmActions -> String)
-> ([EnableAlarmActions] -> ShowS)
-> Show EnableAlarmActions
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. EnableAlarmActions -> Rep EnableAlarmActions x)
-> (forall x. Rep EnableAlarmActions x -> EnableAlarmActions)
-> Generic EnableAlarmActions
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' :: [Text] -> EnableAlarmActions
EnableAlarmActions' {$sel:alarmNames:EnableAlarmActions' :: [Text]
alarmNames = [Text]
forall a. Monoid a => a
Prelude.mempty}

-- | The names of the alarms.
enableAlarmActions_alarmNames :: Lens.Lens' EnableAlarmActions [Prelude.Text]
enableAlarmActions_alarmNames :: ([Text] -> f [Text]) -> EnableAlarmActions -> f EnableAlarmActions
enableAlarmActions_alarmNames = (EnableAlarmActions -> [Text])
-> (EnableAlarmActions -> [Text] -> EnableAlarmActions)
-> Lens EnableAlarmActions EnableAlarmActions [Text] [Text]
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) (([Text] -> f [Text])
 -> EnableAlarmActions -> f EnableAlarmActions)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> EnableAlarmActions
-> f EnableAlarmActions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 :: EnableAlarmActions -> Request EnableAlarmActions
request = Service -> EnableAlarmActions -> Request EnableAlarmActions
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy EnableAlarmActions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse EnableAlarmActions)))
response =
    AWSResponse EnableAlarmActions
-> Logger
-> Service
-> Proxy EnableAlarmActions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse EnableAlarmActions)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse EnableAlarmActions
EnableAlarmActionsResponse
EnableAlarmActionsResponse'

instance Prelude.Hashable EnableAlarmActions

instance Prelude.NFData EnableAlarmActions

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

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

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

-- | /See:/ 'newEnableAlarmActionsResponse' smart constructor.
data EnableAlarmActionsResponse = EnableAlarmActionsResponse'
  {
  }
  deriving (EnableAlarmActionsResponse -> EnableAlarmActionsResponse -> Bool
(EnableAlarmActionsResponse -> EnableAlarmActionsResponse -> Bool)
-> (EnableAlarmActionsResponse
    -> EnableAlarmActionsResponse -> Bool)
-> Eq EnableAlarmActionsResponse
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]
(Int -> ReadS EnableAlarmActionsResponse)
-> ReadS [EnableAlarmActionsResponse]
-> ReadPrec EnableAlarmActionsResponse
-> ReadPrec [EnableAlarmActionsResponse]
-> Read 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
(Int -> EnableAlarmActionsResponse -> ShowS)
-> (EnableAlarmActionsResponse -> String)
-> ([EnableAlarmActionsResponse] -> ShowS)
-> Show EnableAlarmActionsResponse
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.
 EnableAlarmActionsResponse -> Rep EnableAlarmActionsResponse x)
-> (forall x.
    Rep EnableAlarmActionsResponse x -> EnableAlarmActionsResponse)
-> Generic EnableAlarmActionsResponse
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