{-# 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.DescribeLifecycleHookTypes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the available types of lifecycle hooks.
--
-- The following hook types are supported:
--
-- -   @autoscaling:EC2_INSTANCE_LAUNCHING@
--
-- -   @autoscaling:EC2_INSTANCE_TERMINATING@
module Amazonka.AutoScaling.DescribeLifecycleHookTypes
  ( -- * Creating a Request
    DescribeLifecycleHookTypes (..),
    newDescribeLifecycleHookTypes,

    -- * Destructuring the Response
    DescribeLifecycleHookTypesResponse (..),
    newDescribeLifecycleHookTypesResponse,

    -- * Response Lenses
    describeLifecycleHookTypesResponse_lifecycleHookTypes,
    describeLifecycleHookTypesResponse_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:/ 'newDescribeLifecycleHookTypes' smart constructor.
data DescribeLifecycleHookTypes = DescribeLifecycleHookTypes'
  {
  }
  deriving (DescribeLifecycleHookTypes -> DescribeLifecycleHookTypes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLifecycleHookTypes -> DescribeLifecycleHookTypes -> Bool
$c/= :: DescribeLifecycleHookTypes -> DescribeLifecycleHookTypes -> Bool
== :: DescribeLifecycleHookTypes -> DescribeLifecycleHookTypes -> Bool
$c== :: DescribeLifecycleHookTypes -> DescribeLifecycleHookTypes -> Bool
Prelude.Eq, ReadPrec [DescribeLifecycleHookTypes]
ReadPrec DescribeLifecycleHookTypes
Int -> ReadS DescribeLifecycleHookTypes
ReadS [DescribeLifecycleHookTypes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLifecycleHookTypes]
$creadListPrec :: ReadPrec [DescribeLifecycleHookTypes]
readPrec :: ReadPrec DescribeLifecycleHookTypes
$creadPrec :: ReadPrec DescribeLifecycleHookTypes
readList :: ReadS [DescribeLifecycleHookTypes]
$creadList :: ReadS [DescribeLifecycleHookTypes]
readsPrec :: Int -> ReadS DescribeLifecycleHookTypes
$creadsPrec :: Int -> ReadS DescribeLifecycleHookTypes
Prelude.Read, Int -> DescribeLifecycleHookTypes -> ShowS
[DescribeLifecycleHookTypes] -> ShowS
DescribeLifecycleHookTypes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLifecycleHookTypes] -> ShowS
$cshowList :: [DescribeLifecycleHookTypes] -> ShowS
show :: DescribeLifecycleHookTypes -> String
$cshow :: DescribeLifecycleHookTypes -> String
showsPrec :: Int -> DescribeLifecycleHookTypes -> ShowS
$cshowsPrec :: Int -> DescribeLifecycleHookTypes -> ShowS
Prelude.Show, forall x.
Rep DescribeLifecycleHookTypes x -> DescribeLifecycleHookTypes
forall x.
DescribeLifecycleHookTypes -> Rep DescribeLifecycleHookTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeLifecycleHookTypes x -> DescribeLifecycleHookTypes
$cfrom :: forall x.
DescribeLifecycleHookTypes -> Rep DescribeLifecycleHookTypes x
Prelude.Generic)

-- |
-- Create a value of 'DescribeLifecycleHookTypes' 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.
newDescribeLifecycleHookTypes ::
  DescribeLifecycleHookTypes
newDescribeLifecycleHookTypes :: DescribeLifecycleHookTypes
newDescribeLifecycleHookTypes =
  DescribeLifecycleHookTypes
DescribeLifecycleHookTypes'

instance Core.AWSRequest DescribeLifecycleHookTypes where
  type
    AWSResponse DescribeLifecycleHookTypes =
      DescribeLifecycleHookTypesResponse
  request :: (Service -> Service)
-> DescribeLifecycleHookTypes -> Request DescribeLifecycleHookTypes
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 DescribeLifecycleHookTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLifecycleHookTypes)))
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
"DescribeLifecycleHookTypesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [Text] -> Int -> DescribeLifecycleHookTypesResponse
DescribeLifecycleHookTypesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"LifecycleHookTypes"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            forall (f :: * -> *) a b. Applicative f => 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 DescribeLifecycleHookTypes where
  hashWithSalt :: Int -> DescribeLifecycleHookTypes -> Int
hashWithSalt Int
_salt DescribeLifecycleHookTypes
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData DescribeLifecycleHookTypes where
  rnf :: DescribeLifecycleHookTypes -> ()
rnf DescribeLifecycleHookTypes
_ = ()

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

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

instance Data.ToQuery DescribeLifecycleHookTypes where
  toQuery :: DescribeLifecycleHookTypes -> QueryString
toQuery =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ ByteString
"Action"
              forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeLifecycleHookTypes" :: Prelude.ByteString),
            ByteString
"Version"
              forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2011-01-01" :: Prelude.ByteString)
          ]
      )

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

-- |
-- Create a value of 'DescribeLifecycleHookTypesResponse' 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:
--
-- 'lifecycleHookTypes', 'describeLifecycleHookTypesResponse_lifecycleHookTypes' - The lifecycle hook types.
--
-- 'httpStatus', 'describeLifecycleHookTypesResponse_httpStatus' - The response's http status code.
newDescribeLifecycleHookTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeLifecycleHookTypesResponse
newDescribeLifecycleHookTypesResponse :: Int -> DescribeLifecycleHookTypesResponse
newDescribeLifecycleHookTypesResponse Int
pHttpStatus_ =
  DescribeLifecycleHookTypesResponse'
    { $sel:lifecycleHookTypes:DescribeLifecycleHookTypesResponse' :: Maybe [Text]
lifecycleHookTypes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeLifecycleHookTypesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The lifecycle hook types.
describeLifecycleHookTypesResponse_lifecycleHookTypes :: Lens.Lens' DescribeLifecycleHookTypesResponse (Prelude.Maybe [Prelude.Text])
describeLifecycleHookTypesResponse_lifecycleHookTypes :: Lens' DescribeLifecycleHookTypesResponse (Maybe [Text])
describeLifecycleHookTypesResponse_lifecycleHookTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLifecycleHookTypesResponse' {Maybe [Text]
lifecycleHookTypes :: Maybe [Text]
$sel:lifecycleHookTypes:DescribeLifecycleHookTypesResponse' :: DescribeLifecycleHookTypesResponse -> Maybe [Text]
lifecycleHookTypes} -> Maybe [Text]
lifecycleHookTypes) (\s :: DescribeLifecycleHookTypesResponse
s@DescribeLifecycleHookTypesResponse' {} Maybe [Text]
a -> DescribeLifecycleHookTypesResponse
s {$sel:lifecycleHookTypes:DescribeLifecycleHookTypesResponse' :: Maybe [Text]
lifecycleHookTypes = Maybe [Text]
a} :: DescribeLifecycleHookTypesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeLifecycleHookTypesResponse
  where
  rnf :: DescribeLifecycleHookTypesResponse -> ()
rnf DescribeLifecycleHookTypesResponse' {Int
Maybe [Text]
httpStatus :: Int
lifecycleHookTypes :: Maybe [Text]
$sel:httpStatus:DescribeLifecycleHookTypesResponse' :: DescribeLifecycleHookTypesResponse -> Int
$sel:lifecycleHookTypes:DescribeLifecycleHookTypesResponse' :: DescribeLifecycleHookTypesResponse -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
lifecycleHookTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus