{-# 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.AutoScaling.ResumeProcesses
-- 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)
--
-- Resumes the specified suspended auto scaling processes, or all suspended
-- process, for the specified Auto Scaling group.
--
-- For more information, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html Suspending and resuming scaling processes>
-- in the /Amazon EC2 Auto Scaling User Guide/.
module Amazonka.AutoScaling.ResumeProcesses
  ( -- * Creating a Request
    ResumeProcesses (..),
    newResumeProcesses,

    -- * Request Lenses
    resumeProcesses_scalingProcesses,
    resumeProcesses_autoScalingGroupName,

    -- * Destructuring the Response
    ResumeProcessesResponse (..),
    newResumeProcessesResponse,
  )
where

import Amazonka.AutoScaling.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:/ 'newResumeProcesses' smart constructor.
data ResumeProcesses = ResumeProcesses'
  { -- | One or more of the following processes:
    --
    -- -   @Launch@
    --
    -- -   @Terminate@
    --
    -- -   @AddToLoadBalancer@
    --
    -- -   @AlarmNotification@
    --
    -- -   @AZRebalance@
    --
    -- -   @HealthCheck@
    --
    -- -   @InstanceRefresh@
    --
    -- -   @ReplaceUnhealthy@
    --
    -- -   @ScheduledActions@
    --
    -- If you omit this parameter, all processes are specified.
    ResumeProcesses -> Maybe [Text]
scalingProcesses :: Prelude.Maybe [Prelude.Text],
    -- | The name of the Auto Scaling group.
    ResumeProcesses -> Text
autoScalingGroupName :: Prelude.Text
  }
  deriving (ResumeProcesses -> ResumeProcesses -> Bool
(ResumeProcesses -> ResumeProcesses -> Bool)
-> (ResumeProcesses -> ResumeProcesses -> Bool)
-> Eq ResumeProcesses
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResumeProcesses -> ResumeProcesses -> Bool
$c/= :: ResumeProcesses -> ResumeProcesses -> Bool
== :: ResumeProcesses -> ResumeProcesses -> Bool
$c== :: ResumeProcesses -> ResumeProcesses -> Bool
Prelude.Eq, ReadPrec [ResumeProcesses]
ReadPrec ResumeProcesses
Int -> ReadS ResumeProcesses
ReadS [ResumeProcesses]
(Int -> ReadS ResumeProcesses)
-> ReadS [ResumeProcesses]
-> ReadPrec ResumeProcesses
-> ReadPrec [ResumeProcesses]
-> Read ResumeProcesses
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResumeProcesses]
$creadListPrec :: ReadPrec [ResumeProcesses]
readPrec :: ReadPrec ResumeProcesses
$creadPrec :: ReadPrec ResumeProcesses
readList :: ReadS [ResumeProcesses]
$creadList :: ReadS [ResumeProcesses]
readsPrec :: Int -> ReadS ResumeProcesses
$creadsPrec :: Int -> ReadS ResumeProcesses
Prelude.Read, Int -> ResumeProcesses -> ShowS
[ResumeProcesses] -> ShowS
ResumeProcesses -> String
(Int -> ResumeProcesses -> ShowS)
-> (ResumeProcesses -> String)
-> ([ResumeProcesses] -> ShowS)
-> Show ResumeProcesses
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResumeProcesses] -> ShowS
$cshowList :: [ResumeProcesses] -> ShowS
show :: ResumeProcesses -> String
$cshow :: ResumeProcesses -> String
showsPrec :: Int -> ResumeProcesses -> ShowS
$cshowsPrec :: Int -> ResumeProcesses -> ShowS
Prelude.Show, (forall x. ResumeProcesses -> Rep ResumeProcesses x)
-> (forall x. Rep ResumeProcesses x -> ResumeProcesses)
-> Generic ResumeProcesses
forall x. Rep ResumeProcesses x -> ResumeProcesses
forall x. ResumeProcesses -> Rep ResumeProcesses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResumeProcesses x -> ResumeProcesses
$cfrom :: forall x. ResumeProcesses -> Rep ResumeProcesses x
Prelude.Generic)

-- |
-- Create a value of 'ResumeProcesses' 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:
--
-- 'scalingProcesses', 'resumeProcesses_scalingProcesses' - One or more of the following processes:
--
-- -   @Launch@
--
-- -   @Terminate@
--
-- -   @AddToLoadBalancer@
--
-- -   @AlarmNotification@
--
-- -   @AZRebalance@
--
-- -   @HealthCheck@
--
-- -   @InstanceRefresh@
--
-- -   @ReplaceUnhealthy@
--
-- -   @ScheduledActions@
--
-- If you omit this parameter, all processes are specified.
--
-- 'autoScalingGroupName', 'resumeProcesses_autoScalingGroupName' - The name of the Auto Scaling group.
newResumeProcesses ::
  -- | 'autoScalingGroupName'
  Prelude.Text ->
  ResumeProcesses
newResumeProcesses :: Text -> ResumeProcesses
newResumeProcesses Text
pAutoScalingGroupName_ =
  ResumeProcesses' :: Maybe [Text] -> Text -> ResumeProcesses
ResumeProcesses'
    { $sel:scalingProcesses:ResumeProcesses' :: Maybe [Text]
scalingProcesses =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroupName:ResumeProcesses' :: Text
autoScalingGroupName = Text
pAutoScalingGroupName_
    }

-- | One or more of the following processes:
--
-- -   @Launch@
--
-- -   @Terminate@
--
-- -   @AddToLoadBalancer@
--
-- -   @AlarmNotification@
--
-- -   @AZRebalance@
--
-- -   @HealthCheck@
--
-- -   @InstanceRefresh@
--
-- -   @ReplaceUnhealthy@
--
-- -   @ScheduledActions@
--
-- If you omit this parameter, all processes are specified.
resumeProcesses_scalingProcesses :: Lens.Lens' ResumeProcesses (Prelude.Maybe [Prelude.Text])
resumeProcesses_scalingProcesses :: (Maybe [Text] -> f (Maybe [Text]))
-> ResumeProcesses -> f ResumeProcesses
resumeProcesses_scalingProcesses = (ResumeProcesses -> Maybe [Text])
-> (ResumeProcesses -> Maybe [Text] -> ResumeProcesses)
-> Lens
     ResumeProcesses ResumeProcesses (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResumeProcesses' {Maybe [Text]
scalingProcesses :: Maybe [Text]
$sel:scalingProcesses:ResumeProcesses' :: ResumeProcesses -> Maybe [Text]
scalingProcesses} -> Maybe [Text]
scalingProcesses) (\s :: ResumeProcesses
s@ResumeProcesses' {} Maybe [Text]
a -> ResumeProcesses
s {$sel:scalingProcesses:ResumeProcesses' :: Maybe [Text]
scalingProcesses = Maybe [Text]
a} :: ResumeProcesses) ((Maybe [Text] -> f (Maybe [Text]))
 -> ResumeProcesses -> f ResumeProcesses)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ResumeProcesses
-> f ResumeProcesses
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the Auto Scaling group.
resumeProcesses_autoScalingGroupName :: Lens.Lens' ResumeProcesses Prelude.Text
resumeProcesses_autoScalingGroupName :: (Text -> f Text) -> ResumeProcesses -> f ResumeProcesses
resumeProcesses_autoScalingGroupName = (ResumeProcesses -> Text)
-> (ResumeProcesses -> Text -> ResumeProcesses)
-> Lens ResumeProcesses ResumeProcesses Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResumeProcesses' {Text
autoScalingGroupName :: Text
$sel:autoScalingGroupName:ResumeProcesses' :: ResumeProcesses -> Text
autoScalingGroupName} -> Text
autoScalingGroupName) (\s :: ResumeProcesses
s@ResumeProcesses' {} Text
a -> ResumeProcesses
s {$sel:autoScalingGroupName:ResumeProcesses' :: Text
autoScalingGroupName = Text
a} :: ResumeProcesses)

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

instance Prelude.Hashable ResumeProcesses

instance Prelude.NFData ResumeProcesses

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

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

instance Core.ToQuery ResumeProcesses where
  toQuery :: ResumeProcesses -> QueryString
toQuery ResumeProcesses' {Maybe [Text]
Text
autoScalingGroupName :: Text
scalingProcesses :: Maybe [Text]
$sel:autoScalingGroupName:ResumeProcesses' :: ResumeProcesses -> Text
$sel:scalingProcesses:ResumeProcesses' :: ResumeProcesses -> Maybe [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
"ResumeProcesses" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
        ByteString
"ScalingProcesses"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
scalingProcesses
            ),
        ByteString
"AutoScalingGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
autoScalingGroupName
      ]

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

-- |
-- Create a value of 'ResumeProcessesResponse' 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.
newResumeProcessesResponse ::
  ResumeProcessesResponse
newResumeProcessesResponse :: ResumeProcessesResponse
newResumeProcessesResponse = ResumeProcessesResponse
ResumeProcessesResponse'

instance Prelude.NFData ResumeProcessesResponse