{-# 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.EMR.PutAutoScalingPolicy
-- 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)
--
-- Creates or updates an automatic scaling policy for a core instance group
-- or task instance group in an Amazon EMR cluster. The automatic scaling
-- policy defines how an instance group dynamically adds and terminates EC2
-- instances in response to the value of a CloudWatch metric.
module Amazonka.EMR.PutAutoScalingPolicy
  ( -- * Creating a Request
    PutAutoScalingPolicy (..),
    newPutAutoScalingPolicy,

    -- * Request Lenses
    putAutoScalingPolicy_clusterId,
    putAutoScalingPolicy_instanceGroupId,
    putAutoScalingPolicy_autoScalingPolicy,

    -- * Destructuring the Response
    PutAutoScalingPolicyResponse (..),
    newPutAutoScalingPolicyResponse,

    -- * Response Lenses
    putAutoScalingPolicyResponse_clusterArn,
    putAutoScalingPolicyResponse_clusterId,
    putAutoScalingPolicyResponse_autoScalingPolicy,
    putAutoScalingPolicyResponse_instanceGroupId,
    putAutoScalingPolicyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types
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:/ 'newPutAutoScalingPolicy' smart constructor.
data PutAutoScalingPolicy = PutAutoScalingPolicy'
  { -- | Specifies the ID of a cluster. The instance group to which the automatic
    -- scaling policy is applied is within this cluster.
    PutAutoScalingPolicy -> Text
clusterId :: Prelude.Text,
    -- | Specifies the ID of the instance group to which the automatic scaling
    -- policy is applied.
    PutAutoScalingPolicy -> Text
instanceGroupId :: Prelude.Text,
    -- | Specifies the definition of the automatic scaling policy.
    PutAutoScalingPolicy -> AutoScalingPolicy
autoScalingPolicy :: AutoScalingPolicy
  }
  deriving (PutAutoScalingPolicy -> PutAutoScalingPolicy -> Bool
(PutAutoScalingPolicy -> PutAutoScalingPolicy -> Bool)
-> (PutAutoScalingPolicy -> PutAutoScalingPolicy -> Bool)
-> Eq PutAutoScalingPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAutoScalingPolicy -> PutAutoScalingPolicy -> Bool
$c/= :: PutAutoScalingPolicy -> PutAutoScalingPolicy -> Bool
== :: PutAutoScalingPolicy -> PutAutoScalingPolicy -> Bool
$c== :: PutAutoScalingPolicy -> PutAutoScalingPolicy -> Bool
Prelude.Eq, ReadPrec [PutAutoScalingPolicy]
ReadPrec PutAutoScalingPolicy
Int -> ReadS PutAutoScalingPolicy
ReadS [PutAutoScalingPolicy]
(Int -> ReadS PutAutoScalingPolicy)
-> ReadS [PutAutoScalingPolicy]
-> ReadPrec PutAutoScalingPolicy
-> ReadPrec [PutAutoScalingPolicy]
-> Read PutAutoScalingPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAutoScalingPolicy]
$creadListPrec :: ReadPrec [PutAutoScalingPolicy]
readPrec :: ReadPrec PutAutoScalingPolicy
$creadPrec :: ReadPrec PutAutoScalingPolicy
readList :: ReadS [PutAutoScalingPolicy]
$creadList :: ReadS [PutAutoScalingPolicy]
readsPrec :: Int -> ReadS PutAutoScalingPolicy
$creadsPrec :: Int -> ReadS PutAutoScalingPolicy
Prelude.Read, Int -> PutAutoScalingPolicy -> ShowS
[PutAutoScalingPolicy] -> ShowS
PutAutoScalingPolicy -> String
(Int -> PutAutoScalingPolicy -> ShowS)
-> (PutAutoScalingPolicy -> String)
-> ([PutAutoScalingPolicy] -> ShowS)
-> Show PutAutoScalingPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAutoScalingPolicy] -> ShowS
$cshowList :: [PutAutoScalingPolicy] -> ShowS
show :: PutAutoScalingPolicy -> String
$cshow :: PutAutoScalingPolicy -> String
showsPrec :: Int -> PutAutoScalingPolicy -> ShowS
$cshowsPrec :: Int -> PutAutoScalingPolicy -> ShowS
Prelude.Show, (forall x. PutAutoScalingPolicy -> Rep PutAutoScalingPolicy x)
-> (forall x. Rep PutAutoScalingPolicy x -> PutAutoScalingPolicy)
-> Generic PutAutoScalingPolicy
forall x. Rep PutAutoScalingPolicy x -> PutAutoScalingPolicy
forall x. PutAutoScalingPolicy -> Rep PutAutoScalingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutAutoScalingPolicy x -> PutAutoScalingPolicy
$cfrom :: forall x. PutAutoScalingPolicy -> Rep PutAutoScalingPolicy x
Prelude.Generic)

-- |
-- Create a value of 'PutAutoScalingPolicy' 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:
--
-- 'clusterId', 'putAutoScalingPolicy_clusterId' - Specifies the ID of a cluster. The instance group to which the automatic
-- scaling policy is applied is within this cluster.
--
-- 'instanceGroupId', 'putAutoScalingPolicy_instanceGroupId' - Specifies the ID of the instance group to which the automatic scaling
-- policy is applied.
--
-- 'autoScalingPolicy', 'putAutoScalingPolicy_autoScalingPolicy' - Specifies the definition of the automatic scaling policy.
newPutAutoScalingPolicy ::
  -- | 'clusterId'
  Prelude.Text ->
  -- | 'instanceGroupId'
  Prelude.Text ->
  -- | 'autoScalingPolicy'
  AutoScalingPolicy ->
  PutAutoScalingPolicy
newPutAutoScalingPolicy :: Text -> Text -> AutoScalingPolicy -> PutAutoScalingPolicy
newPutAutoScalingPolicy
  Text
pClusterId_
  Text
pInstanceGroupId_
  AutoScalingPolicy
pAutoScalingPolicy_ =
    PutAutoScalingPolicy' :: Text -> Text -> AutoScalingPolicy -> PutAutoScalingPolicy
PutAutoScalingPolicy'
      { $sel:clusterId:PutAutoScalingPolicy' :: Text
clusterId = Text
pClusterId_,
        $sel:instanceGroupId:PutAutoScalingPolicy' :: Text
instanceGroupId = Text
pInstanceGroupId_,
        $sel:autoScalingPolicy:PutAutoScalingPolicy' :: AutoScalingPolicy
autoScalingPolicy = AutoScalingPolicy
pAutoScalingPolicy_
      }

-- | Specifies the ID of a cluster. The instance group to which the automatic
-- scaling policy is applied is within this cluster.
putAutoScalingPolicy_clusterId :: Lens.Lens' PutAutoScalingPolicy Prelude.Text
putAutoScalingPolicy_clusterId :: (Text -> f Text) -> PutAutoScalingPolicy -> f PutAutoScalingPolicy
putAutoScalingPolicy_clusterId = (PutAutoScalingPolicy -> Text)
-> (PutAutoScalingPolicy -> Text -> PutAutoScalingPolicy)
-> Lens PutAutoScalingPolicy PutAutoScalingPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicy' {Text
clusterId :: Text
$sel:clusterId:PutAutoScalingPolicy' :: PutAutoScalingPolicy -> Text
clusterId} -> Text
clusterId) (\s :: PutAutoScalingPolicy
s@PutAutoScalingPolicy' {} Text
a -> PutAutoScalingPolicy
s {$sel:clusterId:PutAutoScalingPolicy' :: Text
clusterId = Text
a} :: PutAutoScalingPolicy)

-- | Specifies the ID of the instance group to which the automatic scaling
-- policy is applied.
putAutoScalingPolicy_instanceGroupId :: Lens.Lens' PutAutoScalingPolicy Prelude.Text
putAutoScalingPolicy_instanceGroupId :: (Text -> f Text) -> PutAutoScalingPolicy -> f PutAutoScalingPolicy
putAutoScalingPolicy_instanceGroupId = (PutAutoScalingPolicy -> Text)
-> (PutAutoScalingPolicy -> Text -> PutAutoScalingPolicy)
-> Lens PutAutoScalingPolicy PutAutoScalingPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicy' {Text
instanceGroupId :: Text
$sel:instanceGroupId:PutAutoScalingPolicy' :: PutAutoScalingPolicy -> Text
instanceGroupId} -> Text
instanceGroupId) (\s :: PutAutoScalingPolicy
s@PutAutoScalingPolicy' {} Text
a -> PutAutoScalingPolicy
s {$sel:instanceGroupId:PutAutoScalingPolicy' :: Text
instanceGroupId = Text
a} :: PutAutoScalingPolicy)

-- | Specifies the definition of the automatic scaling policy.
putAutoScalingPolicy_autoScalingPolicy :: Lens.Lens' PutAutoScalingPolicy AutoScalingPolicy
putAutoScalingPolicy_autoScalingPolicy :: (AutoScalingPolicy -> f AutoScalingPolicy)
-> PutAutoScalingPolicy -> f PutAutoScalingPolicy
putAutoScalingPolicy_autoScalingPolicy = (PutAutoScalingPolicy -> AutoScalingPolicy)
-> (PutAutoScalingPolicy
    -> AutoScalingPolicy -> PutAutoScalingPolicy)
-> Lens
     PutAutoScalingPolicy
     PutAutoScalingPolicy
     AutoScalingPolicy
     AutoScalingPolicy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicy' {AutoScalingPolicy
autoScalingPolicy :: AutoScalingPolicy
$sel:autoScalingPolicy:PutAutoScalingPolicy' :: PutAutoScalingPolicy -> AutoScalingPolicy
autoScalingPolicy} -> AutoScalingPolicy
autoScalingPolicy) (\s :: PutAutoScalingPolicy
s@PutAutoScalingPolicy' {} AutoScalingPolicy
a -> PutAutoScalingPolicy
s {$sel:autoScalingPolicy:PutAutoScalingPolicy' :: AutoScalingPolicy
autoScalingPolicy = AutoScalingPolicy
a} :: PutAutoScalingPolicy)

instance Core.AWSRequest PutAutoScalingPolicy where
  type
    AWSResponse PutAutoScalingPolicy =
      PutAutoScalingPolicyResponse
  request :: PutAutoScalingPolicy -> Request PutAutoScalingPolicy
request = Service -> PutAutoScalingPolicy -> Request PutAutoScalingPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutAutoScalingPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutAutoScalingPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutAutoScalingPolicy))
-> Logger
-> Service
-> Proxy PutAutoScalingPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutAutoScalingPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe AutoScalingPolicyDescription
-> Maybe Text
-> Int
-> PutAutoScalingPolicyResponse
PutAutoScalingPolicyResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe AutoScalingPolicyDescription
 -> Maybe Text
 -> Int
 -> PutAutoScalingPolicyResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe AutoScalingPolicyDescription
      -> Maybe Text
      -> Int
      -> PutAutoScalingPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ClusterArn")
            Either
  String
  (Maybe Text
   -> Maybe AutoScalingPolicyDescription
   -> Maybe Text
   -> Int
   -> PutAutoScalingPolicyResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe AutoScalingPolicyDescription
      -> Maybe Text -> Int -> PutAutoScalingPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ClusterId")
            Either
  String
  (Maybe AutoScalingPolicyDescription
   -> Maybe Text -> Int -> PutAutoScalingPolicyResponse)
-> Either String (Maybe AutoScalingPolicyDescription)
-> Either
     String (Maybe Text -> Int -> PutAutoScalingPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe AutoScalingPolicyDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AutoScalingPolicy")
            Either String (Maybe Text -> Int -> PutAutoScalingPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutAutoScalingPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InstanceGroupId")
            Either String (Int -> PutAutoScalingPolicyResponse)
-> Either String Int -> Either String PutAutoScalingPolicyResponse
forall (f :: * -> *) a b. Applicative f => 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 PutAutoScalingPolicy

instance Prelude.NFData PutAutoScalingPolicy

instance Core.ToHeaders PutAutoScalingPolicy where
  toHeaders :: PutAutoScalingPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutAutoScalingPolicy -> 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
"ElasticMapReduce.PutAutoScalingPolicy" ::
                          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 PutAutoScalingPolicy where
  toJSON :: PutAutoScalingPolicy -> Value
toJSON PutAutoScalingPolicy' {Text
AutoScalingPolicy
autoScalingPolicy :: AutoScalingPolicy
instanceGroupId :: Text
clusterId :: Text
$sel:autoScalingPolicy:PutAutoScalingPolicy' :: PutAutoScalingPolicy -> AutoScalingPolicy
$sel:instanceGroupId:PutAutoScalingPolicy' :: PutAutoScalingPolicy -> Text
$sel:clusterId:PutAutoScalingPolicy' :: PutAutoScalingPolicy -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClusterId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InstanceGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceGroupId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AutoScalingPolicy" Text -> AutoScalingPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AutoScalingPolicy
autoScalingPolicy)
          ]
      )

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

instance Core.ToQuery PutAutoScalingPolicy where
  toQuery :: PutAutoScalingPolicy -> QueryString
toQuery = QueryString -> PutAutoScalingPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newPutAutoScalingPolicyResponse' smart constructor.
data PutAutoScalingPolicyResponse = PutAutoScalingPolicyResponse'
  { -- | The Amazon Resource Name (ARN) of the cluster.
    PutAutoScalingPolicyResponse -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies the ID of a cluster. The instance group to which the automatic
    -- scaling policy is applied is within this cluster.
    PutAutoScalingPolicyResponse -> Maybe Text
clusterId :: Prelude.Maybe Prelude.Text,
    -- | The automatic scaling policy definition.
    PutAutoScalingPolicyResponse -> Maybe AutoScalingPolicyDescription
autoScalingPolicy :: Prelude.Maybe AutoScalingPolicyDescription,
    -- | Specifies the ID of the instance group to which the scaling policy is
    -- applied.
    PutAutoScalingPolicyResponse -> Maybe Text
instanceGroupId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    PutAutoScalingPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutAutoScalingPolicyResponse
-> PutAutoScalingPolicyResponse -> Bool
(PutAutoScalingPolicyResponse
 -> PutAutoScalingPolicyResponse -> Bool)
-> (PutAutoScalingPolicyResponse
    -> PutAutoScalingPolicyResponse -> Bool)
-> Eq PutAutoScalingPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAutoScalingPolicyResponse
-> PutAutoScalingPolicyResponse -> Bool
$c/= :: PutAutoScalingPolicyResponse
-> PutAutoScalingPolicyResponse -> Bool
== :: PutAutoScalingPolicyResponse
-> PutAutoScalingPolicyResponse -> Bool
$c== :: PutAutoScalingPolicyResponse
-> PutAutoScalingPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutAutoScalingPolicyResponse]
ReadPrec PutAutoScalingPolicyResponse
Int -> ReadS PutAutoScalingPolicyResponse
ReadS [PutAutoScalingPolicyResponse]
(Int -> ReadS PutAutoScalingPolicyResponse)
-> ReadS [PutAutoScalingPolicyResponse]
-> ReadPrec PutAutoScalingPolicyResponse
-> ReadPrec [PutAutoScalingPolicyResponse]
-> Read PutAutoScalingPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAutoScalingPolicyResponse]
$creadListPrec :: ReadPrec [PutAutoScalingPolicyResponse]
readPrec :: ReadPrec PutAutoScalingPolicyResponse
$creadPrec :: ReadPrec PutAutoScalingPolicyResponse
readList :: ReadS [PutAutoScalingPolicyResponse]
$creadList :: ReadS [PutAutoScalingPolicyResponse]
readsPrec :: Int -> ReadS PutAutoScalingPolicyResponse
$creadsPrec :: Int -> ReadS PutAutoScalingPolicyResponse
Prelude.Read, Int -> PutAutoScalingPolicyResponse -> ShowS
[PutAutoScalingPolicyResponse] -> ShowS
PutAutoScalingPolicyResponse -> String
(Int -> PutAutoScalingPolicyResponse -> ShowS)
-> (PutAutoScalingPolicyResponse -> String)
-> ([PutAutoScalingPolicyResponse] -> ShowS)
-> Show PutAutoScalingPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAutoScalingPolicyResponse] -> ShowS
$cshowList :: [PutAutoScalingPolicyResponse] -> ShowS
show :: PutAutoScalingPolicyResponse -> String
$cshow :: PutAutoScalingPolicyResponse -> String
showsPrec :: Int -> PutAutoScalingPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutAutoScalingPolicyResponse -> ShowS
Prelude.Show, (forall x.
 PutAutoScalingPolicyResponse -> Rep PutAutoScalingPolicyResponse x)
-> (forall x.
    Rep PutAutoScalingPolicyResponse x -> PutAutoScalingPolicyResponse)
-> Generic PutAutoScalingPolicyResponse
forall x.
Rep PutAutoScalingPolicyResponse x -> PutAutoScalingPolicyResponse
forall x.
PutAutoScalingPolicyResponse -> Rep PutAutoScalingPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAutoScalingPolicyResponse x -> PutAutoScalingPolicyResponse
$cfrom :: forall x.
PutAutoScalingPolicyResponse -> Rep PutAutoScalingPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutAutoScalingPolicyResponse' 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:
--
-- 'clusterArn', 'putAutoScalingPolicyResponse_clusterArn' - The Amazon Resource Name (ARN) of the cluster.
--
-- 'clusterId', 'putAutoScalingPolicyResponse_clusterId' - Specifies the ID of a cluster. The instance group to which the automatic
-- scaling policy is applied is within this cluster.
--
-- 'autoScalingPolicy', 'putAutoScalingPolicyResponse_autoScalingPolicy' - The automatic scaling policy definition.
--
-- 'instanceGroupId', 'putAutoScalingPolicyResponse_instanceGroupId' - Specifies the ID of the instance group to which the scaling policy is
-- applied.
--
-- 'httpStatus', 'putAutoScalingPolicyResponse_httpStatus' - The response's http status code.
newPutAutoScalingPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutAutoScalingPolicyResponse
newPutAutoScalingPolicyResponse :: Int -> PutAutoScalingPolicyResponse
newPutAutoScalingPolicyResponse Int
pHttpStatus_ =
  PutAutoScalingPolicyResponse' :: Maybe Text
-> Maybe Text
-> Maybe AutoScalingPolicyDescription
-> Maybe Text
-> Int
-> PutAutoScalingPolicyResponse
PutAutoScalingPolicyResponse'
    { $sel:clusterArn:PutAutoScalingPolicyResponse' :: Maybe Text
clusterArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterId:PutAutoScalingPolicyResponse' :: Maybe Text
clusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingPolicy:PutAutoScalingPolicyResponse' :: Maybe AutoScalingPolicyDescription
autoScalingPolicy = Maybe AutoScalingPolicyDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceGroupId:PutAutoScalingPolicyResponse' :: Maybe Text
instanceGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutAutoScalingPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the cluster.
putAutoScalingPolicyResponse_clusterArn :: Lens.Lens' PutAutoScalingPolicyResponse (Prelude.Maybe Prelude.Text)
putAutoScalingPolicyResponse_clusterArn :: (Maybe Text -> f (Maybe Text))
-> PutAutoScalingPolicyResponse -> f PutAutoScalingPolicyResponse
putAutoScalingPolicyResponse_clusterArn = (PutAutoScalingPolicyResponse -> Maybe Text)
-> (PutAutoScalingPolicyResponse
    -> Maybe Text -> PutAutoScalingPolicyResponse)
-> Lens
     PutAutoScalingPolicyResponse
     PutAutoScalingPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicyResponse' {Maybe Text
clusterArn :: Maybe Text
$sel:clusterArn:PutAutoScalingPolicyResponse' :: PutAutoScalingPolicyResponse -> Maybe Text
clusterArn} -> Maybe Text
clusterArn) (\s :: PutAutoScalingPolicyResponse
s@PutAutoScalingPolicyResponse' {} Maybe Text
a -> PutAutoScalingPolicyResponse
s {$sel:clusterArn:PutAutoScalingPolicyResponse' :: Maybe Text
clusterArn = Maybe Text
a} :: PutAutoScalingPolicyResponse)

-- | Specifies the ID of a cluster. The instance group to which the automatic
-- scaling policy is applied is within this cluster.
putAutoScalingPolicyResponse_clusterId :: Lens.Lens' PutAutoScalingPolicyResponse (Prelude.Maybe Prelude.Text)
putAutoScalingPolicyResponse_clusterId :: (Maybe Text -> f (Maybe Text))
-> PutAutoScalingPolicyResponse -> f PutAutoScalingPolicyResponse
putAutoScalingPolicyResponse_clusterId = (PutAutoScalingPolicyResponse -> Maybe Text)
-> (PutAutoScalingPolicyResponse
    -> Maybe Text -> PutAutoScalingPolicyResponse)
-> Lens
     PutAutoScalingPolicyResponse
     PutAutoScalingPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicyResponse' {Maybe Text
clusterId :: Maybe Text
$sel:clusterId:PutAutoScalingPolicyResponse' :: PutAutoScalingPolicyResponse -> Maybe Text
clusterId} -> Maybe Text
clusterId) (\s :: PutAutoScalingPolicyResponse
s@PutAutoScalingPolicyResponse' {} Maybe Text
a -> PutAutoScalingPolicyResponse
s {$sel:clusterId:PutAutoScalingPolicyResponse' :: Maybe Text
clusterId = Maybe Text
a} :: PutAutoScalingPolicyResponse)

-- | The automatic scaling policy definition.
putAutoScalingPolicyResponse_autoScalingPolicy :: Lens.Lens' PutAutoScalingPolicyResponse (Prelude.Maybe AutoScalingPolicyDescription)
putAutoScalingPolicyResponse_autoScalingPolicy :: (Maybe AutoScalingPolicyDescription
 -> f (Maybe AutoScalingPolicyDescription))
-> PutAutoScalingPolicyResponse -> f PutAutoScalingPolicyResponse
putAutoScalingPolicyResponse_autoScalingPolicy = (PutAutoScalingPolicyResponse
 -> Maybe AutoScalingPolicyDescription)
-> (PutAutoScalingPolicyResponse
    -> Maybe AutoScalingPolicyDescription
    -> PutAutoScalingPolicyResponse)
-> Lens
     PutAutoScalingPolicyResponse
     PutAutoScalingPolicyResponse
     (Maybe AutoScalingPolicyDescription)
     (Maybe AutoScalingPolicyDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicyResponse' {Maybe AutoScalingPolicyDescription
autoScalingPolicy :: Maybe AutoScalingPolicyDescription
$sel:autoScalingPolicy:PutAutoScalingPolicyResponse' :: PutAutoScalingPolicyResponse -> Maybe AutoScalingPolicyDescription
autoScalingPolicy} -> Maybe AutoScalingPolicyDescription
autoScalingPolicy) (\s :: PutAutoScalingPolicyResponse
s@PutAutoScalingPolicyResponse' {} Maybe AutoScalingPolicyDescription
a -> PutAutoScalingPolicyResponse
s {$sel:autoScalingPolicy:PutAutoScalingPolicyResponse' :: Maybe AutoScalingPolicyDescription
autoScalingPolicy = Maybe AutoScalingPolicyDescription
a} :: PutAutoScalingPolicyResponse)

-- | Specifies the ID of the instance group to which the scaling policy is
-- applied.
putAutoScalingPolicyResponse_instanceGroupId :: Lens.Lens' PutAutoScalingPolicyResponse (Prelude.Maybe Prelude.Text)
putAutoScalingPolicyResponse_instanceGroupId :: (Maybe Text -> f (Maybe Text))
-> PutAutoScalingPolicyResponse -> f PutAutoScalingPolicyResponse
putAutoScalingPolicyResponse_instanceGroupId = (PutAutoScalingPolicyResponse -> Maybe Text)
-> (PutAutoScalingPolicyResponse
    -> Maybe Text -> PutAutoScalingPolicyResponse)
-> Lens
     PutAutoScalingPolicyResponse
     PutAutoScalingPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicyResponse' {Maybe Text
instanceGroupId :: Maybe Text
$sel:instanceGroupId:PutAutoScalingPolicyResponse' :: PutAutoScalingPolicyResponse -> Maybe Text
instanceGroupId} -> Maybe Text
instanceGroupId) (\s :: PutAutoScalingPolicyResponse
s@PutAutoScalingPolicyResponse' {} Maybe Text
a -> PutAutoScalingPolicyResponse
s {$sel:instanceGroupId:PutAutoScalingPolicyResponse' :: Maybe Text
instanceGroupId = Maybe Text
a} :: PutAutoScalingPolicyResponse)

-- | The response's http status code.
putAutoScalingPolicyResponse_httpStatus :: Lens.Lens' PutAutoScalingPolicyResponse Prelude.Int
putAutoScalingPolicyResponse_httpStatus :: (Int -> f Int)
-> PutAutoScalingPolicyResponse -> f PutAutoScalingPolicyResponse
putAutoScalingPolicyResponse_httpStatus = (PutAutoScalingPolicyResponse -> Int)
-> (PutAutoScalingPolicyResponse
    -> Int -> PutAutoScalingPolicyResponse)
-> Lens
     PutAutoScalingPolicyResponse PutAutoScalingPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoScalingPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAutoScalingPolicyResponse' :: PutAutoScalingPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAutoScalingPolicyResponse
s@PutAutoScalingPolicyResponse' {} Int
a -> PutAutoScalingPolicyResponse
s {$sel:httpStatus:PutAutoScalingPolicyResponse' :: Int
httpStatus = Int
a} :: PutAutoScalingPolicyResponse)

instance Prelude.NFData PutAutoScalingPolicyResponse