{-# 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.AutoScaling.ExecutePolicy
(
ExecutePolicy (..),
newExecutePolicy,
executePolicy_honorCooldown,
executePolicy_metricValue,
executePolicy_autoScalingGroupName,
executePolicy_breachThreshold,
executePolicy_policyName,
ExecutePolicyResponse (..),
newExecutePolicyResponse,
)
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
data ExecutePolicy = ExecutePolicy'
{
ExecutePolicy -> Maybe Bool
honorCooldown :: Prelude.Maybe Prelude.Bool,
ExecutePolicy -> Maybe Double
metricValue :: Prelude.Maybe Prelude.Double,
ExecutePolicy -> Maybe Text
autoScalingGroupName :: Prelude.Maybe Prelude.Text,
ExecutePolicy -> Maybe Double
breachThreshold :: Prelude.Maybe Prelude.Double,
ExecutePolicy -> Text
policyName :: Prelude.Text
}
deriving (ExecutePolicy -> ExecutePolicy -> Bool
(ExecutePolicy -> ExecutePolicy -> Bool)
-> (ExecutePolicy -> ExecutePolicy -> Bool) -> Eq ExecutePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutePolicy -> ExecutePolicy -> Bool
$c/= :: ExecutePolicy -> ExecutePolicy -> Bool
== :: ExecutePolicy -> ExecutePolicy -> Bool
$c== :: ExecutePolicy -> ExecutePolicy -> Bool
Prelude.Eq, ReadPrec [ExecutePolicy]
ReadPrec ExecutePolicy
Int -> ReadS ExecutePolicy
ReadS [ExecutePolicy]
(Int -> ReadS ExecutePolicy)
-> ReadS [ExecutePolicy]
-> ReadPrec ExecutePolicy
-> ReadPrec [ExecutePolicy]
-> Read ExecutePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutePolicy]
$creadListPrec :: ReadPrec [ExecutePolicy]
readPrec :: ReadPrec ExecutePolicy
$creadPrec :: ReadPrec ExecutePolicy
readList :: ReadS [ExecutePolicy]
$creadList :: ReadS [ExecutePolicy]
readsPrec :: Int -> ReadS ExecutePolicy
$creadsPrec :: Int -> ReadS ExecutePolicy
Prelude.Read, Int -> ExecutePolicy -> ShowS
[ExecutePolicy] -> ShowS
ExecutePolicy -> String
(Int -> ExecutePolicy -> ShowS)
-> (ExecutePolicy -> String)
-> ([ExecutePolicy] -> ShowS)
-> Show ExecutePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutePolicy] -> ShowS
$cshowList :: [ExecutePolicy] -> ShowS
show :: ExecutePolicy -> String
$cshow :: ExecutePolicy -> String
showsPrec :: Int -> ExecutePolicy -> ShowS
$cshowsPrec :: Int -> ExecutePolicy -> ShowS
Prelude.Show, (forall x. ExecutePolicy -> Rep ExecutePolicy x)
-> (forall x. Rep ExecutePolicy x -> ExecutePolicy)
-> Generic ExecutePolicy
forall x. Rep ExecutePolicy x -> ExecutePolicy
forall x. ExecutePolicy -> Rep ExecutePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutePolicy x -> ExecutePolicy
$cfrom :: forall x. ExecutePolicy -> Rep ExecutePolicy x
Prelude.Generic)
newExecutePolicy ::
Prelude.Text ->
ExecutePolicy
newExecutePolicy :: Text -> ExecutePolicy
newExecutePolicy Text
pPolicyName_ =
ExecutePolicy' :: Maybe Bool
-> Maybe Double
-> Maybe Text
-> Maybe Double
-> Text
-> ExecutePolicy
ExecutePolicy'
{ $sel:honorCooldown:ExecutePolicy' :: Maybe Bool
honorCooldown = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:metricValue:ExecutePolicy' :: Maybe Double
metricValue = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:autoScalingGroupName:ExecutePolicy' :: Maybe Text
autoScalingGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:breachThreshold:ExecutePolicy' :: Maybe Double
breachThreshold = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:policyName:ExecutePolicy' :: Text
policyName = Text
pPolicyName_
}
executePolicy_honorCooldown :: Lens.Lens' ExecutePolicy (Prelude.Maybe Prelude.Bool)
executePolicy_honorCooldown :: (Maybe Bool -> f (Maybe Bool)) -> ExecutePolicy -> f ExecutePolicy
executePolicy_honorCooldown = (ExecutePolicy -> Maybe Bool)
-> (ExecutePolicy -> Maybe Bool -> ExecutePolicy)
-> Lens ExecutePolicy ExecutePolicy (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutePolicy' {Maybe Bool
honorCooldown :: Maybe Bool
$sel:honorCooldown:ExecutePolicy' :: ExecutePolicy -> Maybe Bool
honorCooldown} -> Maybe Bool
honorCooldown) (\s :: ExecutePolicy
s@ExecutePolicy' {} Maybe Bool
a -> ExecutePolicy
s {$sel:honorCooldown:ExecutePolicy' :: Maybe Bool
honorCooldown = Maybe Bool
a} :: ExecutePolicy)
executePolicy_metricValue :: Lens.Lens' ExecutePolicy (Prelude.Maybe Prelude.Double)
executePolicy_metricValue :: (Maybe Double -> f (Maybe Double))
-> ExecutePolicy -> f ExecutePolicy
executePolicy_metricValue = (ExecutePolicy -> Maybe Double)
-> (ExecutePolicy -> Maybe Double -> ExecutePolicy)
-> Lens ExecutePolicy ExecutePolicy (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutePolicy' {Maybe Double
metricValue :: Maybe Double
$sel:metricValue:ExecutePolicy' :: ExecutePolicy -> Maybe Double
metricValue} -> Maybe Double
metricValue) (\s :: ExecutePolicy
s@ExecutePolicy' {} Maybe Double
a -> ExecutePolicy
s {$sel:metricValue:ExecutePolicy' :: Maybe Double
metricValue = Maybe Double
a} :: ExecutePolicy)
executePolicy_autoScalingGroupName :: Lens.Lens' ExecutePolicy (Prelude.Maybe Prelude.Text)
executePolicy_autoScalingGroupName :: (Maybe Text -> f (Maybe Text)) -> ExecutePolicy -> f ExecutePolicy
executePolicy_autoScalingGroupName = (ExecutePolicy -> Maybe Text)
-> (ExecutePolicy -> Maybe Text -> ExecutePolicy)
-> Lens ExecutePolicy ExecutePolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutePolicy' {Maybe Text
autoScalingGroupName :: Maybe Text
$sel:autoScalingGroupName:ExecutePolicy' :: ExecutePolicy -> Maybe Text
autoScalingGroupName} -> Maybe Text
autoScalingGroupName) (\s :: ExecutePolicy
s@ExecutePolicy' {} Maybe Text
a -> ExecutePolicy
s {$sel:autoScalingGroupName:ExecutePolicy' :: Maybe Text
autoScalingGroupName = Maybe Text
a} :: ExecutePolicy)
executePolicy_breachThreshold :: Lens.Lens' ExecutePolicy (Prelude.Maybe Prelude.Double)
executePolicy_breachThreshold :: (Maybe Double -> f (Maybe Double))
-> ExecutePolicy -> f ExecutePolicy
executePolicy_breachThreshold = (ExecutePolicy -> Maybe Double)
-> (ExecutePolicy -> Maybe Double -> ExecutePolicy)
-> Lens ExecutePolicy ExecutePolicy (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutePolicy' {Maybe Double
breachThreshold :: Maybe Double
$sel:breachThreshold:ExecutePolicy' :: ExecutePolicy -> Maybe Double
breachThreshold} -> Maybe Double
breachThreshold) (\s :: ExecutePolicy
s@ExecutePolicy' {} Maybe Double
a -> ExecutePolicy
s {$sel:breachThreshold:ExecutePolicy' :: Maybe Double
breachThreshold = Maybe Double
a} :: ExecutePolicy)
executePolicy_policyName :: Lens.Lens' ExecutePolicy Prelude.Text
executePolicy_policyName :: (Text -> f Text) -> ExecutePolicy -> f ExecutePolicy
executePolicy_policyName = (ExecutePolicy -> Text)
-> (ExecutePolicy -> Text -> ExecutePolicy)
-> Lens ExecutePolicy ExecutePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutePolicy' {Text
policyName :: Text
$sel:policyName:ExecutePolicy' :: ExecutePolicy -> Text
policyName} -> Text
policyName) (\s :: ExecutePolicy
s@ExecutePolicy' {} Text
a -> ExecutePolicy
s {$sel:policyName:ExecutePolicy' :: Text
policyName = Text
a} :: ExecutePolicy)
instance Core.AWSRequest ExecutePolicy where
type
AWSResponse ExecutePolicy =
ExecutePolicyResponse
request :: ExecutePolicy -> Request ExecutePolicy
request = Service -> ExecutePolicy -> Request ExecutePolicy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy ExecutePolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExecutePolicy)))
response =
AWSResponse ExecutePolicy
-> Logger
-> Service
-> Proxy ExecutePolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExecutePolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse ExecutePolicy
ExecutePolicyResponse
ExecutePolicyResponse'
instance Prelude.Hashable ExecutePolicy
instance Prelude.NFData ExecutePolicy
instance Core.ToHeaders ExecutePolicy where
toHeaders :: ExecutePolicy -> [Header]
toHeaders = [Header] -> ExecutePolicy -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ExecutePolicy where
toPath :: ExecutePolicy -> ByteString
toPath = ByteString -> ExecutePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ExecutePolicy where
toQuery :: ExecutePolicy -> QueryString
toQuery ExecutePolicy' {Maybe Bool
Maybe Double
Maybe Text
Text
policyName :: Text
breachThreshold :: Maybe Double
autoScalingGroupName :: Maybe Text
metricValue :: Maybe Double
honorCooldown :: Maybe Bool
$sel:policyName:ExecutePolicy' :: ExecutePolicy -> Text
$sel:breachThreshold:ExecutePolicy' :: ExecutePolicy -> Maybe Double
$sel:autoScalingGroupName:ExecutePolicy' :: ExecutePolicy -> Maybe Text
$sel:metricValue:ExecutePolicy' :: ExecutePolicy -> Maybe Double
$sel:honorCooldown:ExecutePolicy' :: ExecutePolicy -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ExecutePolicy" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
ByteString
"HonorCooldown" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
honorCooldown,
ByteString
"MetricValue" ByteString -> Maybe Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Double
metricValue,
ByteString
"AutoScalingGroupName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
autoScalingGroupName,
ByteString
"BreachThreshold" ByteString -> Maybe Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Double
breachThreshold,
ByteString
"PolicyName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyName
]
data ExecutePolicyResponse = ExecutePolicyResponse'
{
}
deriving (ExecutePolicyResponse -> ExecutePolicyResponse -> Bool
(ExecutePolicyResponse -> ExecutePolicyResponse -> Bool)
-> (ExecutePolicyResponse -> ExecutePolicyResponse -> Bool)
-> Eq ExecutePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutePolicyResponse -> ExecutePolicyResponse -> Bool
$c/= :: ExecutePolicyResponse -> ExecutePolicyResponse -> Bool
== :: ExecutePolicyResponse -> ExecutePolicyResponse -> Bool
$c== :: ExecutePolicyResponse -> ExecutePolicyResponse -> Bool
Prelude.Eq, ReadPrec [ExecutePolicyResponse]
ReadPrec ExecutePolicyResponse
Int -> ReadS ExecutePolicyResponse
ReadS [ExecutePolicyResponse]
(Int -> ReadS ExecutePolicyResponse)
-> ReadS [ExecutePolicyResponse]
-> ReadPrec ExecutePolicyResponse
-> ReadPrec [ExecutePolicyResponse]
-> Read ExecutePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutePolicyResponse]
$creadListPrec :: ReadPrec [ExecutePolicyResponse]
readPrec :: ReadPrec ExecutePolicyResponse
$creadPrec :: ReadPrec ExecutePolicyResponse
readList :: ReadS [ExecutePolicyResponse]
$creadList :: ReadS [ExecutePolicyResponse]
readsPrec :: Int -> ReadS ExecutePolicyResponse
$creadsPrec :: Int -> ReadS ExecutePolicyResponse
Prelude.Read, Int -> ExecutePolicyResponse -> ShowS
[ExecutePolicyResponse] -> ShowS
ExecutePolicyResponse -> String
(Int -> ExecutePolicyResponse -> ShowS)
-> (ExecutePolicyResponse -> String)
-> ([ExecutePolicyResponse] -> ShowS)
-> Show ExecutePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutePolicyResponse] -> ShowS
$cshowList :: [ExecutePolicyResponse] -> ShowS
show :: ExecutePolicyResponse -> String
$cshow :: ExecutePolicyResponse -> String
showsPrec :: Int -> ExecutePolicyResponse -> ShowS
$cshowsPrec :: Int -> ExecutePolicyResponse -> ShowS
Prelude.Show, (forall x. ExecutePolicyResponse -> Rep ExecutePolicyResponse x)
-> (forall x. Rep ExecutePolicyResponse x -> ExecutePolicyResponse)
-> Generic ExecutePolicyResponse
forall x. Rep ExecutePolicyResponse x -> ExecutePolicyResponse
forall x. ExecutePolicyResponse -> Rep ExecutePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutePolicyResponse x -> ExecutePolicyResponse
$cfrom :: forall x. ExecutePolicyResponse -> Rep ExecutePolicyResponse x
Prelude.Generic)
newExecutePolicyResponse ::
ExecutePolicyResponse
newExecutePolicyResponse :: ExecutePolicyResponse
newExecutePolicyResponse = ExecutePolicyResponse
ExecutePolicyResponse'
instance Prelude.NFData ExecutePolicyResponse