{-# 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.PutLifecycleHook
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates or updates a lifecycle hook for the specified Auto Scaling
-- group.
--
-- Lifecycle hooks let you create solutions that are aware of events in the
-- Auto Scaling instance lifecycle, and then perform a custom action on
-- instances when the corresponding lifecycle event occurs.
--
-- This step is a part of the procedure for adding a lifecycle hook to an
-- Auto Scaling group:
--
-- 1.  (Optional) Create a launch template or launch configuration with a
--     user data script that runs while an instance is in a wait state due
--     to a lifecycle hook.
--
-- 2.  (Optional) Create a Lambda function and a rule that allows Amazon
--     EventBridge to invoke your Lambda function when an instance is put
--     into a wait state due to a lifecycle hook.
--
-- 3.  (Optional) Create a notification target and an IAM role. The target
--     can be either an Amazon SQS queue or an Amazon SNS topic. The role
--     allows Amazon EC2 Auto Scaling to publish lifecycle notifications to
--     the target.
--
-- 4.  __Create the lifecycle hook. Specify whether the hook is used when
--     the instances launch or terminate.__
--
-- 5.  If you need more time, record the lifecycle action heartbeat to keep
--     the instance in a wait state using the
--     RecordLifecycleActionHeartbeat API call.
--
-- 6.  If you finish before the timeout period ends, send a callback by
--     using the CompleteLifecycleAction API call.
--
-- For more information, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html Amazon EC2 Auto Scaling lifecycle hooks>
-- in the /Amazon EC2 Auto Scaling User Guide/.
--
-- If you exceed your maximum limit of lifecycle hooks, which by default is
-- 50 per Auto Scaling group, the call fails.
--
-- You can view the lifecycle hooks for an Auto Scaling group using the
-- DescribeLifecycleHooks API call. If you are no longer using a lifecycle
-- hook, you can delete it by calling the DeleteLifecycleHook API.
module Amazonka.AutoScaling.PutLifecycleHook
  ( -- * Creating a Request
    PutLifecycleHook (..),
    newPutLifecycleHook,

    -- * Request Lenses
    putLifecycleHook_defaultResult,
    putLifecycleHook_heartbeatTimeout,
    putLifecycleHook_lifecycleTransition,
    putLifecycleHook_notificationMetadata,
    putLifecycleHook_notificationTargetARN,
    putLifecycleHook_roleARN,
    putLifecycleHook_lifecycleHookName,
    putLifecycleHook_autoScalingGroupName,

    -- * Destructuring the Response
    PutLifecycleHookResponse (..),
    newPutLifecycleHookResponse,

    -- * Response Lenses
    putLifecycleHookResponse_httpStatus,
  )
where

import Amazonka.AutoScaling.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutLifecycleHook' smart constructor.
data PutLifecycleHook = PutLifecycleHook'
  { -- | The action the Auto Scaling group takes when the lifecycle hook timeout
    -- elapses or if an unexpected failure occurs. The default value is
    -- @ABANDON@.
    --
    -- Valid values: @CONTINUE@ | @ABANDON@
    PutLifecycleHook -> Maybe Text
defaultResult :: Prelude.Maybe Prelude.Text,
    -- | The maximum time, in seconds, that can elapse before the lifecycle hook
    -- times out. The range is from @30@ to @7200@ seconds. The default value
    -- is @3600@ seconds (1 hour).
    PutLifecycleHook -> Maybe Int
heartbeatTimeout :: Prelude.Maybe Prelude.Int,
    -- | The lifecycle transition. For Auto Scaling groups, there are two major
    -- lifecycle transitions.
    --
    -- -   To create a lifecycle hook for scale-out events, specify
    --     @autoscaling:EC2_INSTANCE_LAUNCHING@.
    --
    -- -   To create a lifecycle hook for scale-in events, specify
    --     @autoscaling:EC2_INSTANCE_TERMINATING@.
    --
    -- Required for new lifecycle hooks, but optional when updating existing
    -- hooks.
    PutLifecycleHook -> Maybe Text
lifecycleTransition :: Prelude.Maybe Prelude.Text,
    -- | Additional information that you want to include any time Amazon EC2 Auto
    -- Scaling sends a message to the notification target.
    PutLifecycleHook -> Maybe Text
notificationMetadata :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the notification target that Amazon
    -- EC2 Auto Scaling uses to notify you when an instance is in a wait state
    -- for the lifecycle hook. You can specify either an Amazon SNS topic or an
    -- Amazon SQS queue.
    --
    -- If you specify an empty string, this overrides the current ARN.
    --
    -- This operation uses the JSON format when sending notifications to an
    -- Amazon SQS queue, and an email key-value pair format when sending
    -- notifications to an Amazon SNS topic.
    --
    -- When you specify a notification target, Amazon EC2 Auto Scaling sends it
    -- a test message. Test messages contain the following additional key-value
    -- pair: @\"Event\": \"autoscaling:TEST_NOTIFICATION\"@.
    PutLifecycleHook -> Maybe Text
notificationTargetARN :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM role that allows the Auto Scaling group to publish to
    -- the specified notification target.
    --
    -- Valid only if the notification target is an Amazon SNS topic or an
    -- Amazon SQS queue. Required for new lifecycle hooks, but optional when
    -- updating existing hooks.
    PutLifecycleHook -> Maybe Text
roleARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the lifecycle hook.
    PutLifecycleHook -> Text
lifecycleHookName :: Prelude.Text,
    -- | The name of the Auto Scaling group.
    PutLifecycleHook -> Text
autoScalingGroupName :: Prelude.Text
  }
  deriving (PutLifecycleHook -> PutLifecycleHook -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLifecycleHook -> PutLifecycleHook -> Bool
$c/= :: PutLifecycleHook -> PutLifecycleHook -> Bool
== :: PutLifecycleHook -> PutLifecycleHook -> Bool
$c== :: PutLifecycleHook -> PutLifecycleHook -> Bool
Prelude.Eq, ReadPrec [PutLifecycleHook]
ReadPrec PutLifecycleHook
Int -> ReadS PutLifecycleHook
ReadS [PutLifecycleHook]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLifecycleHook]
$creadListPrec :: ReadPrec [PutLifecycleHook]
readPrec :: ReadPrec PutLifecycleHook
$creadPrec :: ReadPrec PutLifecycleHook
readList :: ReadS [PutLifecycleHook]
$creadList :: ReadS [PutLifecycleHook]
readsPrec :: Int -> ReadS PutLifecycleHook
$creadsPrec :: Int -> ReadS PutLifecycleHook
Prelude.Read, Int -> PutLifecycleHook -> ShowS
[PutLifecycleHook] -> ShowS
PutLifecycleHook -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLifecycleHook] -> ShowS
$cshowList :: [PutLifecycleHook] -> ShowS
show :: PutLifecycleHook -> String
$cshow :: PutLifecycleHook -> String
showsPrec :: Int -> PutLifecycleHook -> ShowS
$cshowsPrec :: Int -> PutLifecycleHook -> ShowS
Prelude.Show, forall x. Rep PutLifecycleHook x -> PutLifecycleHook
forall x. PutLifecycleHook -> Rep PutLifecycleHook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutLifecycleHook x -> PutLifecycleHook
$cfrom :: forall x. PutLifecycleHook -> Rep PutLifecycleHook x
Prelude.Generic)

-- |
-- Create a value of 'PutLifecycleHook' 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:
--
-- 'defaultResult', 'putLifecycleHook_defaultResult' - The action the Auto Scaling group takes when the lifecycle hook timeout
-- elapses or if an unexpected failure occurs. The default value is
-- @ABANDON@.
--
-- Valid values: @CONTINUE@ | @ABANDON@
--
-- 'heartbeatTimeout', 'putLifecycleHook_heartbeatTimeout' - The maximum time, in seconds, that can elapse before the lifecycle hook
-- times out. The range is from @30@ to @7200@ seconds. The default value
-- is @3600@ seconds (1 hour).
--
-- 'lifecycleTransition', 'putLifecycleHook_lifecycleTransition' - The lifecycle transition. For Auto Scaling groups, there are two major
-- lifecycle transitions.
--
-- -   To create a lifecycle hook for scale-out events, specify
--     @autoscaling:EC2_INSTANCE_LAUNCHING@.
--
-- -   To create a lifecycle hook for scale-in events, specify
--     @autoscaling:EC2_INSTANCE_TERMINATING@.
--
-- Required for new lifecycle hooks, but optional when updating existing
-- hooks.
--
-- 'notificationMetadata', 'putLifecycleHook_notificationMetadata' - Additional information that you want to include any time Amazon EC2 Auto
-- Scaling sends a message to the notification target.
--
-- 'notificationTargetARN', 'putLifecycleHook_notificationTargetARN' - The Amazon Resource Name (ARN) of the notification target that Amazon
-- EC2 Auto Scaling uses to notify you when an instance is in a wait state
-- for the lifecycle hook. You can specify either an Amazon SNS topic or an
-- Amazon SQS queue.
--
-- If you specify an empty string, this overrides the current ARN.
--
-- This operation uses the JSON format when sending notifications to an
-- Amazon SQS queue, and an email key-value pair format when sending
-- notifications to an Amazon SNS topic.
--
-- When you specify a notification target, Amazon EC2 Auto Scaling sends it
-- a test message. Test messages contain the following additional key-value
-- pair: @\"Event\": \"autoscaling:TEST_NOTIFICATION\"@.
--
-- 'roleARN', 'putLifecycleHook_roleARN' - The ARN of the IAM role that allows the Auto Scaling group to publish to
-- the specified notification target.
--
-- Valid only if the notification target is an Amazon SNS topic or an
-- Amazon SQS queue. Required for new lifecycle hooks, but optional when
-- updating existing hooks.
--
-- 'lifecycleHookName', 'putLifecycleHook_lifecycleHookName' - The name of the lifecycle hook.
--
-- 'autoScalingGroupName', 'putLifecycleHook_autoScalingGroupName' - The name of the Auto Scaling group.
newPutLifecycleHook ::
  -- | 'lifecycleHookName'
  Prelude.Text ->
  -- | 'autoScalingGroupName'
  Prelude.Text ->
  PutLifecycleHook
newPutLifecycleHook :: Text -> Text -> PutLifecycleHook
newPutLifecycleHook
  Text
pLifecycleHookName_
  Text
pAutoScalingGroupName_ =
    PutLifecycleHook'
      { $sel:defaultResult:PutLifecycleHook' :: Maybe Text
defaultResult = forall a. Maybe a
Prelude.Nothing,
        $sel:heartbeatTimeout:PutLifecycleHook' :: Maybe Int
heartbeatTimeout = forall a. Maybe a
Prelude.Nothing,
        $sel:lifecycleTransition:PutLifecycleHook' :: Maybe Text
lifecycleTransition = forall a. Maybe a
Prelude.Nothing,
        $sel:notificationMetadata:PutLifecycleHook' :: Maybe Text
notificationMetadata = forall a. Maybe a
Prelude.Nothing,
        $sel:notificationTargetARN:PutLifecycleHook' :: Maybe Text
notificationTargetARN = forall a. Maybe a
Prelude.Nothing,
        $sel:roleARN:PutLifecycleHook' :: Maybe Text
roleARN = forall a. Maybe a
Prelude.Nothing,
        $sel:lifecycleHookName:PutLifecycleHook' :: Text
lifecycleHookName = Text
pLifecycleHookName_,
        $sel:autoScalingGroupName:PutLifecycleHook' :: Text
autoScalingGroupName = Text
pAutoScalingGroupName_
      }

-- | The action the Auto Scaling group takes when the lifecycle hook timeout
-- elapses or if an unexpected failure occurs. The default value is
-- @ABANDON@.
--
-- Valid values: @CONTINUE@ | @ABANDON@
putLifecycleHook_defaultResult :: Lens.Lens' PutLifecycleHook (Prelude.Maybe Prelude.Text)
putLifecycleHook_defaultResult :: Lens' PutLifecycleHook (Maybe Text)
putLifecycleHook_defaultResult = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleHook' {Maybe Text
defaultResult :: Maybe Text
$sel:defaultResult:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
defaultResult} -> Maybe Text
defaultResult) (\s :: PutLifecycleHook
s@PutLifecycleHook' {} Maybe Text
a -> PutLifecycleHook
s {$sel:defaultResult:PutLifecycleHook' :: Maybe Text
defaultResult = Maybe Text
a} :: PutLifecycleHook)

-- | The maximum time, in seconds, that can elapse before the lifecycle hook
-- times out. The range is from @30@ to @7200@ seconds. The default value
-- is @3600@ seconds (1 hour).
putLifecycleHook_heartbeatTimeout :: Lens.Lens' PutLifecycleHook (Prelude.Maybe Prelude.Int)
putLifecycleHook_heartbeatTimeout :: Lens' PutLifecycleHook (Maybe Int)
putLifecycleHook_heartbeatTimeout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleHook' {Maybe Int
heartbeatTimeout :: Maybe Int
$sel:heartbeatTimeout:PutLifecycleHook' :: PutLifecycleHook -> Maybe Int
heartbeatTimeout} -> Maybe Int
heartbeatTimeout) (\s :: PutLifecycleHook
s@PutLifecycleHook' {} Maybe Int
a -> PutLifecycleHook
s {$sel:heartbeatTimeout:PutLifecycleHook' :: Maybe Int
heartbeatTimeout = Maybe Int
a} :: PutLifecycleHook)

-- | The lifecycle transition. For Auto Scaling groups, there are two major
-- lifecycle transitions.
--
-- -   To create a lifecycle hook for scale-out events, specify
--     @autoscaling:EC2_INSTANCE_LAUNCHING@.
--
-- -   To create a lifecycle hook for scale-in events, specify
--     @autoscaling:EC2_INSTANCE_TERMINATING@.
--
-- Required for new lifecycle hooks, but optional when updating existing
-- hooks.
putLifecycleHook_lifecycleTransition :: Lens.Lens' PutLifecycleHook (Prelude.Maybe Prelude.Text)
putLifecycleHook_lifecycleTransition :: Lens' PutLifecycleHook (Maybe Text)
putLifecycleHook_lifecycleTransition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleHook' {Maybe Text
lifecycleTransition :: Maybe Text
$sel:lifecycleTransition:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
lifecycleTransition} -> Maybe Text
lifecycleTransition) (\s :: PutLifecycleHook
s@PutLifecycleHook' {} Maybe Text
a -> PutLifecycleHook
s {$sel:lifecycleTransition:PutLifecycleHook' :: Maybe Text
lifecycleTransition = Maybe Text
a} :: PutLifecycleHook)

-- | Additional information that you want to include any time Amazon EC2 Auto
-- Scaling sends a message to the notification target.
putLifecycleHook_notificationMetadata :: Lens.Lens' PutLifecycleHook (Prelude.Maybe Prelude.Text)
putLifecycleHook_notificationMetadata :: Lens' PutLifecycleHook (Maybe Text)
putLifecycleHook_notificationMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleHook' {Maybe Text
notificationMetadata :: Maybe Text
$sel:notificationMetadata:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
notificationMetadata} -> Maybe Text
notificationMetadata) (\s :: PutLifecycleHook
s@PutLifecycleHook' {} Maybe Text
a -> PutLifecycleHook
s {$sel:notificationMetadata:PutLifecycleHook' :: Maybe Text
notificationMetadata = Maybe Text
a} :: PutLifecycleHook)

-- | The Amazon Resource Name (ARN) of the notification target that Amazon
-- EC2 Auto Scaling uses to notify you when an instance is in a wait state
-- for the lifecycle hook. You can specify either an Amazon SNS topic or an
-- Amazon SQS queue.
--
-- If you specify an empty string, this overrides the current ARN.
--
-- This operation uses the JSON format when sending notifications to an
-- Amazon SQS queue, and an email key-value pair format when sending
-- notifications to an Amazon SNS topic.
--
-- When you specify a notification target, Amazon EC2 Auto Scaling sends it
-- a test message. Test messages contain the following additional key-value
-- pair: @\"Event\": \"autoscaling:TEST_NOTIFICATION\"@.
putLifecycleHook_notificationTargetARN :: Lens.Lens' PutLifecycleHook (Prelude.Maybe Prelude.Text)
putLifecycleHook_notificationTargetARN :: Lens' PutLifecycleHook (Maybe Text)
putLifecycleHook_notificationTargetARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleHook' {Maybe Text
notificationTargetARN :: Maybe Text
$sel:notificationTargetARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
notificationTargetARN} -> Maybe Text
notificationTargetARN) (\s :: PutLifecycleHook
s@PutLifecycleHook' {} Maybe Text
a -> PutLifecycleHook
s {$sel:notificationTargetARN:PutLifecycleHook' :: Maybe Text
notificationTargetARN = Maybe Text
a} :: PutLifecycleHook)

-- | The ARN of the IAM role that allows the Auto Scaling group to publish to
-- the specified notification target.
--
-- Valid only if the notification target is an Amazon SNS topic or an
-- Amazon SQS queue. Required for new lifecycle hooks, but optional when
-- updating existing hooks.
putLifecycleHook_roleARN :: Lens.Lens' PutLifecycleHook (Prelude.Maybe Prelude.Text)
putLifecycleHook_roleARN :: Lens' PutLifecycleHook (Maybe Text)
putLifecycleHook_roleARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleHook' {Maybe Text
roleARN :: Maybe Text
$sel:roleARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
roleARN} -> Maybe Text
roleARN) (\s :: PutLifecycleHook
s@PutLifecycleHook' {} Maybe Text
a -> PutLifecycleHook
s {$sel:roleARN:PutLifecycleHook' :: Maybe Text
roleARN = Maybe Text
a} :: PutLifecycleHook)

-- | The name of the lifecycle hook.
putLifecycleHook_lifecycleHookName :: Lens.Lens' PutLifecycleHook Prelude.Text
putLifecycleHook_lifecycleHookName :: Lens' PutLifecycleHook Text
putLifecycleHook_lifecycleHookName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleHook' {Text
lifecycleHookName :: Text
$sel:lifecycleHookName:PutLifecycleHook' :: PutLifecycleHook -> Text
lifecycleHookName} -> Text
lifecycleHookName) (\s :: PutLifecycleHook
s@PutLifecycleHook' {} Text
a -> PutLifecycleHook
s {$sel:lifecycleHookName:PutLifecycleHook' :: Text
lifecycleHookName = Text
a} :: PutLifecycleHook)

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

instance Core.AWSRequest PutLifecycleHook where
  type
    AWSResponse PutLifecycleHook =
      PutLifecycleHookResponse
  request :: (Service -> Service)
-> PutLifecycleHook -> Request PutLifecycleHook
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutLifecycleHook
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutLifecycleHook)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"PutLifecycleHookResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> PutLifecycleHookResponse
PutLifecycleHookResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutLifecycleHook where
  hashWithSalt :: Int -> PutLifecycleHook -> Int
hashWithSalt Int
_salt PutLifecycleHook' {Maybe Int
Maybe Text
Text
autoScalingGroupName :: Text
lifecycleHookName :: Text
roleARN :: Maybe Text
notificationTargetARN :: Maybe Text
notificationMetadata :: Maybe Text
lifecycleTransition :: Maybe Text
heartbeatTimeout :: Maybe Int
defaultResult :: Maybe Text
$sel:autoScalingGroupName:PutLifecycleHook' :: PutLifecycleHook -> Text
$sel:lifecycleHookName:PutLifecycleHook' :: PutLifecycleHook -> Text
$sel:roleARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:notificationTargetARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:notificationMetadata:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:lifecycleTransition:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:heartbeatTimeout:PutLifecycleHook' :: PutLifecycleHook -> Maybe Int
$sel:defaultResult:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultResult
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
heartbeatTimeout
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lifecycleTransition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notificationMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notificationTargetARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
lifecycleHookName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
autoScalingGroupName

instance Prelude.NFData PutLifecycleHook where
  rnf :: PutLifecycleHook -> ()
rnf PutLifecycleHook' {Maybe Int
Maybe Text
Text
autoScalingGroupName :: Text
lifecycleHookName :: Text
roleARN :: Maybe Text
notificationTargetARN :: Maybe Text
notificationMetadata :: Maybe Text
lifecycleTransition :: Maybe Text
heartbeatTimeout :: Maybe Int
defaultResult :: Maybe Text
$sel:autoScalingGroupName:PutLifecycleHook' :: PutLifecycleHook -> Text
$sel:lifecycleHookName:PutLifecycleHook' :: PutLifecycleHook -> Text
$sel:roleARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:notificationTargetARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:notificationMetadata:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:lifecycleTransition:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:heartbeatTimeout:PutLifecycleHook' :: PutLifecycleHook -> Maybe Int
$sel:defaultResult:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultResult
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
heartbeatTimeout
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lifecycleTransition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
notificationMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
notificationTargetARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
lifecycleHookName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
autoScalingGroupName

instance Data.ToHeaders PutLifecycleHook where
  toHeaders :: PutLifecycleHook -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery PutLifecycleHook where
  toQuery :: PutLifecycleHook -> QueryString
toQuery PutLifecycleHook' {Maybe Int
Maybe Text
Text
autoScalingGroupName :: Text
lifecycleHookName :: Text
roleARN :: Maybe Text
notificationTargetARN :: Maybe Text
notificationMetadata :: Maybe Text
lifecycleTransition :: Maybe Text
heartbeatTimeout :: Maybe Int
defaultResult :: Maybe Text
$sel:autoScalingGroupName:PutLifecycleHook' :: PutLifecycleHook -> Text
$sel:lifecycleHookName:PutLifecycleHook' :: PutLifecycleHook -> Text
$sel:roleARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:notificationTargetARN:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:notificationMetadata:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:lifecycleTransition:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
$sel:heartbeatTimeout:PutLifecycleHook' :: PutLifecycleHook -> Maybe Int
$sel:defaultResult:PutLifecycleHook' :: PutLifecycleHook -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"PutLifecycleHook" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
        ByteString
"DefaultResult" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
defaultResult,
        ByteString
"HeartbeatTimeout" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
heartbeatTimeout,
        ByteString
"LifecycleTransition" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
lifecycleTransition,
        ByteString
"NotificationMetadata" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
notificationMetadata,
        ByteString
"NotificationTargetARN"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
notificationTargetARN,
        ByteString
"RoleARN" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
roleARN,
        ByteString
"LifecycleHookName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
lifecycleHookName,
        ByteString
"AutoScalingGroupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
autoScalingGroupName
      ]

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

-- |
-- Create a value of 'PutLifecycleHookResponse' 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:
--
-- 'httpStatus', 'putLifecycleHookResponse_httpStatus' - The response's http status code.
newPutLifecycleHookResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutLifecycleHookResponse
newPutLifecycleHookResponse :: Int -> PutLifecycleHookResponse
newPutLifecycleHookResponse Int
pHttpStatus_ =
  PutLifecycleHookResponse'
    { $sel:httpStatus:PutLifecycleHookResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData PutLifecycleHookResponse where
  rnf :: PutLifecycleHookResponse -> ()
rnf PutLifecycleHookResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutLifecycleHookResponse' :: PutLifecycleHookResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus