{-# 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.AutoScalingPlans.UpdateScalingPlan
(
UpdateScalingPlan (..),
newUpdateScalingPlan,
updateScalingPlan_scalingInstructions,
updateScalingPlan_applicationSource,
updateScalingPlan_scalingPlanName,
updateScalingPlan_scalingPlanVersion,
UpdateScalingPlanResponse (..),
newUpdateScalingPlanResponse,
updateScalingPlanResponse_httpStatus,
)
where
import Amazonka.AutoScalingPlans.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 UpdateScalingPlan = UpdateScalingPlan'
{
UpdateScalingPlan -> Maybe [ScalingInstruction]
scalingInstructions :: Prelude.Maybe [ScalingInstruction],
UpdateScalingPlan -> Maybe ApplicationSource
applicationSource :: Prelude.Maybe ApplicationSource,
UpdateScalingPlan -> Text
scalingPlanName :: Prelude.Text,
UpdateScalingPlan -> Integer
scalingPlanVersion :: Prelude.Integer
}
deriving (UpdateScalingPlan -> UpdateScalingPlan -> Bool
(UpdateScalingPlan -> UpdateScalingPlan -> Bool)
-> (UpdateScalingPlan -> UpdateScalingPlan -> Bool)
-> Eq UpdateScalingPlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScalingPlan -> UpdateScalingPlan -> Bool
$c/= :: UpdateScalingPlan -> UpdateScalingPlan -> Bool
== :: UpdateScalingPlan -> UpdateScalingPlan -> Bool
$c== :: UpdateScalingPlan -> UpdateScalingPlan -> Bool
Prelude.Eq, ReadPrec [UpdateScalingPlan]
ReadPrec UpdateScalingPlan
Int -> ReadS UpdateScalingPlan
ReadS [UpdateScalingPlan]
(Int -> ReadS UpdateScalingPlan)
-> ReadS [UpdateScalingPlan]
-> ReadPrec UpdateScalingPlan
-> ReadPrec [UpdateScalingPlan]
-> Read UpdateScalingPlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScalingPlan]
$creadListPrec :: ReadPrec [UpdateScalingPlan]
readPrec :: ReadPrec UpdateScalingPlan
$creadPrec :: ReadPrec UpdateScalingPlan
readList :: ReadS [UpdateScalingPlan]
$creadList :: ReadS [UpdateScalingPlan]
readsPrec :: Int -> ReadS UpdateScalingPlan
$creadsPrec :: Int -> ReadS UpdateScalingPlan
Prelude.Read, Int -> UpdateScalingPlan -> ShowS
[UpdateScalingPlan] -> ShowS
UpdateScalingPlan -> String
(Int -> UpdateScalingPlan -> ShowS)
-> (UpdateScalingPlan -> String)
-> ([UpdateScalingPlan] -> ShowS)
-> Show UpdateScalingPlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScalingPlan] -> ShowS
$cshowList :: [UpdateScalingPlan] -> ShowS
show :: UpdateScalingPlan -> String
$cshow :: UpdateScalingPlan -> String
showsPrec :: Int -> UpdateScalingPlan -> ShowS
$cshowsPrec :: Int -> UpdateScalingPlan -> ShowS
Prelude.Show, (forall x. UpdateScalingPlan -> Rep UpdateScalingPlan x)
-> (forall x. Rep UpdateScalingPlan x -> UpdateScalingPlan)
-> Generic UpdateScalingPlan
forall x. Rep UpdateScalingPlan x -> UpdateScalingPlan
forall x. UpdateScalingPlan -> Rep UpdateScalingPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateScalingPlan x -> UpdateScalingPlan
$cfrom :: forall x. UpdateScalingPlan -> Rep UpdateScalingPlan x
Prelude.Generic)
newUpdateScalingPlan ::
Prelude.Text ->
Prelude.Integer ->
UpdateScalingPlan
newUpdateScalingPlan :: Text -> Integer -> UpdateScalingPlan
newUpdateScalingPlan
Text
pScalingPlanName_
Integer
pScalingPlanVersion_ =
UpdateScalingPlan' :: Maybe [ScalingInstruction]
-> Maybe ApplicationSource -> Text -> Integer -> UpdateScalingPlan
UpdateScalingPlan'
{ $sel:scalingInstructions:UpdateScalingPlan' :: Maybe [ScalingInstruction]
scalingInstructions =
Maybe [ScalingInstruction]
forall a. Maybe a
Prelude.Nothing,
$sel:applicationSource:UpdateScalingPlan' :: Maybe ApplicationSource
applicationSource = Maybe ApplicationSource
forall a. Maybe a
Prelude.Nothing,
$sel:scalingPlanName:UpdateScalingPlan' :: Text
scalingPlanName = Text
pScalingPlanName_,
$sel:scalingPlanVersion:UpdateScalingPlan' :: Integer
scalingPlanVersion = Integer
pScalingPlanVersion_
}
updateScalingPlan_scalingInstructions :: Lens.Lens' UpdateScalingPlan (Prelude.Maybe [ScalingInstruction])
updateScalingPlan_scalingInstructions :: (Maybe [ScalingInstruction] -> f (Maybe [ScalingInstruction]))
-> UpdateScalingPlan -> f UpdateScalingPlan
updateScalingPlan_scalingInstructions = (UpdateScalingPlan -> Maybe [ScalingInstruction])
-> (UpdateScalingPlan
-> Maybe [ScalingInstruction] -> UpdateScalingPlan)
-> Lens
UpdateScalingPlan
UpdateScalingPlan
(Maybe [ScalingInstruction])
(Maybe [ScalingInstruction])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingPlan' {Maybe [ScalingInstruction]
scalingInstructions :: Maybe [ScalingInstruction]
$sel:scalingInstructions:UpdateScalingPlan' :: UpdateScalingPlan -> Maybe [ScalingInstruction]
scalingInstructions} -> Maybe [ScalingInstruction]
scalingInstructions) (\s :: UpdateScalingPlan
s@UpdateScalingPlan' {} Maybe [ScalingInstruction]
a -> UpdateScalingPlan
s {$sel:scalingInstructions:UpdateScalingPlan' :: Maybe [ScalingInstruction]
scalingInstructions = Maybe [ScalingInstruction]
a} :: UpdateScalingPlan) ((Maybe [ScalingInstruction] -> f (Maybe [ScalingInstruction]))
-> UpdateScalingPlan -> f UpdateScalingPlan)
-> ((Maybe [ScalingInstruction] -> f (Maybe [ScalingInstruction]))
-> Maybe [ScalingInstruction] -> f (Maybe [ScalingInstruction]))
-> (Maybe [ScalingInstruction] -> f (Maybe [ScalingInstruction]))
-> UpdateScalingPlan
-> f UpdateScalingPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ScalingInstruction]
[ScalingInstruction]
[ScalingInstruction]
[ScalingInstruction]
-> Iso
(Maybe [ScalingInstruction])
(Maybe [ScalingInstruction])
(Maybe [ScalingInstruction])
(Maybe [ScalingInstruction])
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
[ScalingInstruction]
[ScalingInstruction]
[ScalingInstruction]
[ScalingInstruction]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateScalingPlan_applicationSource :: Lens.Lens' UpdateScalingPlan (Prelude.Maybe ApplicationSource)
updateScalingPlan_applicationSource :: (Maybe ApplicationSource -> f (Maybe ApplicationSource))
-> UpdateScalingPlan -> f UpdateScalingPlan
updateScalingPlan_applicationSource = (UpdateScalingPlan -> Maybe ApplicationSource)
-> (UpdateScalingPlan
-> Maybe ApplicationSource -> UpdateScalingPlan)
-> Lens
UpdateScalingPlan
UpdateScalingPlan
(Maybe ApplicationSource)
(Maybe ApplicationSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingPlan' {Maybe ApplicationSource
applicationSource :: Maybe ApplicationSource
$sel:applicationSource:UpdateScalingPlan' :: UpdateScalingPlan -> Maybe ApplicationSource
applicationSource} -> Maybe ApplicationSource
applicationSource) (\s :: UpdateScalingPlan
s@UpdateScalingPlan' {} Maybe ApplicationSource
a -> UpdateScalingPlan
s {$sel:applicationSource:UpdateScalingPlan' :: Maybe ApplicationSource
applicationSource = Maybe ApplicationSource
a} :: UpdateScalingPlan)
updateScalingPlan_scalingPlanName :: Lens.Lens' UpdateScalingPlan Prelude.Text
updateScalingPlan_scalingPlanName :: (Text -> f Text) -> UpdateScalingPlan -> f UpdateScalingPlan
updateScalingPlan_scalingPlanName = (UpdateScalingPlan -> Text)
-> (UpdateScalingPlan -> Text -> UpdateScalingPlan)
-> Lens UpdateScalingPlan UpdateScalingPlan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingPlan' {Text
scalingPlanName :: Text
$sel:scalingPlanName:UpdateScalingPlan' :: UpdateScalingPlan -> Text
scalingPlanName} -> Text
scalingPlanName) (\s :: UpdateScalingPlan
s@UpdateScalingPlan' {} Text
a -> UpdateScalingPlan
s {$sel:scalingPlanName:UpdateScalingPlan' :: Text
scalingPlanName = Text
a} :: UpdateScalingPlan)
updateScalingPlan_scalingPlanVersion :: Lens.Lens' UpdateScalingPlan Prelude.Integer
updateScalingPlan_scalingPlanVersion :: (Integer -> f Integer) -> UpdateScalingPlan -> f UpdateScalingPlan
updateScalingPlan_scalingPlanVersion = (UpdateScalingPlan -> Integer)
-> (UpdateScalingPlan -> Integer -> UpdateScalingPlan)
-> Lens UpdateScalingPlan UpdateScalingPlan Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingPlan' {Integer
scalingPlanVersion :: Integer
$sel:scalingPlanVersion:UpdateScalingPlan' :: UpdateScalingPlan -> Integer
scalingPlanVersion} -> Integer
scalingPlanVersion) (\s :: UpdateScalingPlan
s@UpdateScalingPlan' {} Integer
a -> UpdateScalingPlan
s {$sel:scalingPlanVersion:UpdateScalingPlan' :: Integer
scalingPlanVersion = Integer
a} :: UpdateScalingPlan)
instance Core.AWSRequest UpdateScalingPlan where
type
AWSResponse UpdateScalingPlan =
UpdateScalingPlanResponse
request :: UpdateScalingPlan -> Request UpdateScalingPlan
request = Service -> UpdateScalingPlan -> Request UpdateScalingPlan
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateScalingPlan
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateScalingPlan)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateScalingPlan))
-> Logger
-> Service
-> Proxy UpdateScalingPlan
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateScalingPlan)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateScalingPlanResponse
UpdateScalingPlanResponse'
(Int -> UpdateScalingPlanResponse)
-> Either String Int -> Either String UpdateScalingPlanResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateScalingPlan
instance Prelude.NFData UpdateScalingPlan
instance Core.ToHeaders UpdateScalingPlan where
toHeaders :: UpdateScalingPlan -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateScalingPlan -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AnyScaleScalingPlannerFrontendService.UpdateScalingPlan" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateScalingPlan where
toJSON :: UpdateScalingPlan -> Value
toJSON UpdateScalingPlan' {Integer
Maybe [ScalingInstruction]
Maybe ApplicationSource
Text
scalingPlanVersion :: Integer
scalingPlanName :: Text
applicationSource :: Maybe ApplicationSource
scalingInstructions :: Maybe [ScalingInstruction]
$sel:scalingPlanVersion:UpdateScalingPlan' :: UpdateScalingPlan -> Integer
$sel:scalingPlanName:UpdateScalingPlan' :: UpdateScalingPlan -> Text
$sel:applicationSource:UpdateScalingPlan' :: UpdateScalingPlan -> Maybe ApplicationSource
$sel:scalingInstructions:UpdateScalingPlan' :: UpdateScalingPlan -> Maybe [ScalingInstruction]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ScalingInstructions" Text -> [ScalingInstruction] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([ScalingInstruction] -> Pair)
-> Maybe [ScalingInstruction] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ScalingInstruction]
scalingInstructions,
(Text
"ApplicationSource" Text -> ApplicationSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ApplicationSource -> Pair)
-> Maybe ApplicationSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ApplicationSource
applicationSource,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ScalingPlanName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
scalingPlanName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ScalingPlanVersion" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
scalingPlanVersion)
]
)
instance Core.ToPath UpdateScalingPlan where
toPath :: UpdateScalingPlan -> ByteString
toPath = ByteString -> UpdateScalingPlan -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateScalingPlan where
toQuery :: UpdateScalingPlan -> QueryString
toQuery = QueryString -> UpdateScalingPlan -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateScalingPlanResponse = UpdateScalingPlanResponse'
{
UpdateScalingPlanResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateScalingPlanResponse -> UpdateScalingPlanResponse -> Bool
(UpdateScalingPlanResponse -> UpdateScalingPlanResponse -> Bool)
-> (UpdateScalingPlanResponse -> UpdateScalingPlanResponse -> Bool)
-> Eq UpdateScalingPlanResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScalingPlanResponse -> UpdateScalingPlanResponse -> Bool
$c/= :: UpdateScalingPlanResponse -> UpdateScalingPlanResponse -> Bool
== :: UpdateScalingPlanResponse -> UpdateScalingPlanResponse -> Bool
$c== :: UpdateScalingPlanResponse -> UpdateScalingPlanResponse -> Bool
Prelude.Eq, ReadPrec [UpdateScalingPlanResponse]
ReadPrec UpdateScalingPlanResponse
Int -> ReadS UpdateScalingPlanResponse
ReadS [UpdateScalingPlanResponse]
(Int -> ReadS UpdateScalingPlanResponse)
-> ReadS [UpdateScalingPlanResponse]
-> ReadPrec UpdateScalingPlanResponse
-> ReadPrec [UpdateScalingPlanResponse]
-> Read UpdateScalingPlanResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScalingPlanResponse]
$creadListPrec :: ReadPrec [UpdateScalingPlanResponse]
readPrec :: ReadPrec UpdateScalingPlanResponse
$creadPrec :: ReadPrec UpdateScalingPlanResponse
readList :: ReadS [UpdateScalingPlanResponse]
$creadList :: ReadS [UpdateScalingPlanResponse]
readsPrec :: Int -> ReadS UpdateScalingPlanResponse
$creadsPrec :: Int -> ReadS UpdateScalingPlanResponse
Prelude.Read, Int -> UpdateScalingPlanResponse -> ShowS
[UpdateScalingPlanResponse] -> ShowS
UpdateScalingPlanResponse -> String
(Int -> UpdateScalingPlanResponse -> ShowS)
-> (UpdateScalingPlanResponse -> String)
-> ([UpdateScalingPlanResponse] -> ShowS)
-> Show UpdateScalingPlanResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScalingPlanResponse] -> ShowS
$cshowList :: [UpdateScalingPlanResponse] -> ShowS
show :: UpdateScalingPlanResponse -> String
$cshow :: UpdateScalingPlanResponse -> String
showsPrec :: Int -> UpdateScalingPlanResponse -> ShowS
$cshowsPrec :: Int -> UpdateScalingPlanResponse -> ShowS
Prelude.Show, (forall x.
UpdateScalingPlanResponse -> Rep UpdateScalingPlanResponse x)
-> (forall x.
Rep UpdateScalingPlanResponse x -> UpdateScalingPlanResponse)
-> Generic UpdateScalingPlanResponse
forall x.
Rep UpdateScalingPlanResponse x -> UpdateScalingPlanResponse
forall x.
UpdateScalingPlanResponse -> Rep UpdateScalingPlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateScalingPlanResponse x -> UpdateScalingPlanResponse
$cfrom :: forall x.
UpdateScalingPlanResponse -> Rep UpdateScalingPlanResponse x
Prelude.Generic)
newUpdateScalingPlanResponse ::
Prelude.Int ->
UpdateScalingPlanResponse
newUpdateScalingPlanResponse :: Int -> UpdateScalingPlanResponse
newUpdateScalingPlanResponse Int
pHttpStatus_ =
UpdateScalingPlanResponse' :: Int -> UpdateScalingPlanResponse
UpdateScalingPlanResponse'
{ $sel:httpStatus:UpdateScalingPlanResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateScalingPlanResponse_httpStatus :: Lens.Lens' UpdateScalingPlanResponse Prelude.Int
updateScalingPlanResponse_httpStatus :: (Int -> f Int)
-> UpdateScalingPlanResponse -> f UpdateScalingPlanResponse
updateScalingPlanResponse_httpStatus = (UpdateScalingPlanResponse -> Int)
-> (UpdateScalingPlanResponse -> Int -> UpdateScalingPlanResponse)
-> Lens UpdateScalingPlanResponse UpdateScalingPlanResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingPlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateScalingPlanResponse' :: UpdateScalingPlanResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateScalingPlanResponse
s@UpdateScalingPlanResponse' {} Int
a -> UpdateScalingPlanResponse
s {$sel:httpStatus:UpdateScalingPlanResponse' :: Int
httpStatus = Int
a} :: UpdateScalingPlanResponse)
instance Prelude.NFData UpdateScalingPlanResponse