{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ScalingProcessQuery
-- 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)
module Amazonka.AutoScaling.Types.ScalingProcessQuery where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newScalingProcessQuery' smart constructor.
data ScalingProcessQuery = ScalingProcessQuery'
  { -- | 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.
    ScalingProcessQuery -> Maybe [Text]
scalingProcesses :: Prelude.Maybe [Prelude.Text],
    -- | The name of the Auto Scaling group.
    ScalingProcessQuery -> Text
autoScalingGroupName :: Prelude.Text
  }
  deriving (ScalingProcessQuery -> ScalingProcessQuery -> Bool
(ScalingProcessQuery -> ScalingProcessQuery -> Bool)
-> (ScalingProcessQuery -> ScalingProcessQuery -> Bool)
-> Eq ScalingProcessQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingProcessQuery -> ScalingProcessQuery -> Bool
$c/= :: ScalingProcessQuery -> ScalingProcessQuery -> Bool
== :: ScalingProcessQuery -> ScalingProcessQuery -> Bool
$c== :: ScalingProcessQuery -> ScalingProcessQuery -> Bool
Prelude.Eq, ReadPrec [ScalingProcessQuery]
ReadPrec ScalingProcessQuery
Int -> ReadS ScalingProcessQuery
ReadS [ScalingProcessQuery]
(Int -> ReadS ScalingProcessQuery)
-> ReadS [ScalingProcessQuery]
-> ReadPrec ScalingProcessQuery
-> ReadPrec [ScalingProcessQuery]
-> Read ScalingProcessQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingProcessQuery]
$creadListPrec :: ReadPrec [ScalingProcessQuery]
readPrec :: ReadPrec ScalingProcessQuery
$creadPrec :: ReadPrec ScalingProcessQuery
readList :: ReadS [ScalingProcessQuery]
$creadList :: ReadS [ScalingProcessQuery]
readsPrec :: Int -> ReadS ScalingProcessQuery
$creadsPrec :: Int -> ReadS ScalingProcessQuery
Prelude.Read, Int -> ScalingProcessQuery -> ShowS
[ScalingProcessQuery] -> ShowS
ScalingProcessQuery -> String
(Int -> ScalingProcessQuery -> ShowS)
-> (ScalingProcessQuery -> String)
-> ([ScalingProcessQuery] -> ShowS)
-> Show ScalingProcessQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingProcessQuery] -> ShowS
$cshowList :: [ScalingProcessQuery] -> ShowS
show :: ScalingProcessQuery -> String
$cshow :: ScalingProcessQuery -> String
showsPrec :: Int -> ScalingProcessQuery -> ShowS
$cshowsPrec :: Int -> ScalingProcessQuery -> ShowS
Prelude.Show, (forall x. ScalingProcessQuery -> Rep ScalingProcessQuery x)
-> (forall x. Rep ScalingProcessQuery x -> ScalingProcessQuery)
-> Generic ScalingProcessQuery
forall x. Rep ScalingProcessQuery x -> ScalingProcessQuery
forall x. ScalingProcessQuery -> Rep ScalingProcessQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingProcessQuery x -> ScalingProcessQuery
$cfrom :: forall x. ScalingProcessQuery -> Rep ScalingProcessQuery x
Prelude.Generic)

-- |
-- Create a value of 'ScalingProcessQuery' 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', 'scalingProcessQuery_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', 'scalingProcessQuery_autoScalingGroupName' - The name of the Auto Scaling group.
newScalingProcessQuery ::
  -- | 'autoScalingGroupName'
  Prelude.Text ->
  ScalingProcessQuery
newScalingProcessQuery :: Text -> ScalingProcessQuery
newScalingProcessQuery Text
pAutoScalingGroupName_ =
  ScalingProcessQuery' :: Maybe [Text] -> Text -> ScalingProcessQuery
ScalingProcessQuery'
    { $sel:scalingProcesses:ScalingProcessQuery' :: Maybe [Text]
scalingProcesses =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroupName:ScalingProcessQuery' :: 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.
scalingProcessQuery_scalingProcesses :: Lens.Lens' ScalingProcessQuery (Prelude.Maybe [Prelude.Text])
scalingProcessQuery_scalingProcesses :: (Maybe [Text] -> f (Maybe [Text]))
-> ScalingProcessQuery -> f ScalingProcessQuery
scalingProcessQuery_scalingProcesses = (ScalingProcessQuery -> Maybe [Text])
-> (ScalingProcessQuery -> Maybe [Text] -> ScalingProcessQuery)
-> Lens
     ScalingProcessQuery
     ScalingProcessQuery
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingProcessQuery' {Maybe [Text]
scalingProcesses :: Maybe [Text]
$sel:scalingProcesses:ScalingProcessQuery' :: ScalingProcessQuery -> Maybe [Text]
scalingProcesses} -> Maybe [Text]
scalingProcesses) (\s :: ScalingProcessQuery
s@ScalingProcessQuery' {} Maybe [Text]
a -> ScalingProcessQuery
s {$sel:scalingProcesses:ScalingProcessQuery' :: Maybe [Text]
scalingProcesses = Maybe [Text]
a} :: ScalingProcessQuery) ((Maybe [Text] -> f (Maybe [Text]))
 -> ScalingProcessQuery -> f ScalingProcessQuery)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ScalingProcessQuery
-> f ScalingProcessQuery
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.
scalingProcessQuery_autoScalingGroupName :: Lens.Lens' ScalingProcessQuery Prelude.Text
scalingProcessQuery_autoScalingGroupName :: (Text -> f Text) -> ScalingProcessQuery -> f ScalingProcessQuery
scalingProcessQuery_autoScalingGroupName = (ScalingProcessQuery -> Text)
-> (ScalingProcessQuery -> Text -> ScalingProcessQuery)
-> Lens ScalingProcessQuery ScalingProcessQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingProcessQuery' {Text
autoScalingGroupName :: Text
$sel:autoScalingGroupName:ScalingProcessQuery' :: ScalingProcessQuery -> Text
autoScalingGroupName} -> Text
autoScalingGroupName) (\s :: ScalingProcessQuery
s@ScalingProcessQuery' {} Text
a -> ScalingProcessQuery
s {$sel:autoScalingGroupName:ScalingProcessQuery' :: Text
autoScalingGroupName = Text
a} :: ScalingProcessQuery)

instance Prelude.Hashable ScalingProcessQuery

instance Prelude.NFData ScalingProcessQuery

instance Core.ToQuery ScalingProcessQuery where
  toQuery :: ScalingProcessQuery -> QueryString
toQuery ScalingProcessQuery' {Maybe [Text]
Text
autoScalingGroupName :: Text
scalingProcesses :: Maybe [Text]
$sel:autoScalingGroupName:ScalingProcessQuery' :: ScalingProcessQuery -> Text
$sel:scalingProcesses:ScalingProcessQuery' :: ScalingProcessQuery -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ 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
      ]