{-# 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-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)
--
-- 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.Lens as Lens
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
(DescribeLifecycleHookTypes -> DescribeLifecycleHookTypes -> Bool)
-> (DescribeLifecycleHookTypes
    -> DescribeLifecycleHookTypes -> Bool)
-> Eq DescribeLifecycleHookTypes
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]
(Int -> ReadS DescribeLifecycleHookTypes)
-> ReadS [DescribeLifecycleHookTypes]
-> ReadPrec DescribeLifecycleHookTypes
-> ReadPrec [DescribeLifecycleHookTypes]
-> Read 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
(Int -> DescribeLifecycleHookTypes -> ShowS)
-> (DescribeLifecycleHookTypes -> String)
-> ([DescribeLifecycleHookTypes] -> ShowS)
-> Show DescribeLifecycleHookTypes
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.
 DescribeLifecycleHookTypes -> Rep DescribeLifecycleHookTypes x)
-> (forall x.
    Rep DescribeLifecycleHookTypes x -> DescribeLifecycleHookTypes)
-> Generic DescribeLifecycleHookTypes
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 :: DescribeLifecycleHookTypes -> Request DescribeLifecycleHookTypes
request = Service
-> DescribeLifecycleHookTypes -> Request DescribeLifecycleHookTypes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeLifecycleHookTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLifecycleHookTypes)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeLifecycleHookTypes))
-> Logger
-> Service
-> Proxy DescribeLifecycleHookTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLifecycleHookTypes)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> 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'
            (Maybe [Text] -> Int -> DescribeLifecycleHookTypesResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> DescribeLifecycleHookTypesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LifecycleHookTypes"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> DescribeLifecycleHookTypesResponse)
-> Either String Int
-> Either String DescribeLifecycleHookTypesResponse
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 DescribeLifecycleHookTypes

instance Prelude.NFData DescribeLifecycleHookTypes

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

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

instance Core.ToQuery DescribeLifecycleHookTypes where
  toQuery :: DescribeLifecycleHookTypes -> QueryString
toQuery =
    QueryString -> DescribeLifecycleHookTypes -> QueryString
forall a b. a -> b -> a
Prelude.const
      ( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ ByteString
"Action"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeLifecycleHookTypes" :: Prelude.ByteString),
            ByteString
"Version"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (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
(DescribeLifecycleHookTypesResponse
 -> DescribeLifecycleHookTypesResponse -> Bool)
-> (DescribeLifecycleHookTypesResponse
    -> DescribeLifecycleHookTypesResponse -> Bool)
-> Eq DescribeLifecycleHookTypesResponse
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]
(Int -> ReadS DescribeLifecycleHookTypesResponse)
-> ReadS [DescribeLifecycleHookTypesResponse]
-> ReadPrec DescribeLifecycleHookTypesResponse
-> ReadPrec [DescribeLifecycleHookTypesResponse]
-> Read 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
(Int -> DescribeLifecycleHookTypesResponse -> ShowS)
-> (DescribeLifecycleHookTypesResponse -> String)
-> ([DescribeLifecycleHookTypesResponse] -> ShowS)
-> Show DescribeLifecycleHookTypesResponse
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.
 DescribeLifecycleHookTypesResponse
 -> Rep DescribeLifecycleHookTypesResponse x)
-> (forall x.
    Rep DescribeLifecycleHookTypesResponse x
    -> DescribeLifecycleHookTypesResponse)
-> Generic DescribeLifecycleHookTypesResponse
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' :: Maybe [Text] -> Int -> DescribeLifecycleHookTypesResponse
DescribeLifecycleHookTypesResponse'
    { $sel:lifecycleHookTypes:DescribeLifecycleHookTypesResponse' :: Maybe [Text]
lifecycleHookTypes =
        Maybe [Text]
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 :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeLifecycleHookTypesResponse
-> f DescribeLifecycleHookTypesResponse
describeLifecycleHookTypesResponse_lifecycleHookTypes = (DescribeLifecycleHookTypesResponse -> Maybe [Text])
-> (DescribeLifecycleHookTypesResponse
    -> Maybe [Text] -> DescribeLifecycleHookTypesResponse)
-> Lens
     DescribeLifecycleHookTypesResponse
     DescribeLifecycleHookTypesResponse
     (Maybe [Text])
     (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeLifecycleHookTypesResponse
 -> f DescribeLifecycleHookTypesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeLifecycleHookTypesResponse
-> f DescribeLifecycleHookTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
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 :: (Int -> f Int)
-> DescribeLifecycleHookTypesResponse
-> f DescribeLifecycleHookTypesResponse
describeLifecycleHookTypesResponse_httpStatus = (DescribeLifecycleHookTypesResponse -> Int)
-> (DescribeLifecycleHookTypesResponse
    -> Int -> DescribeLifecycleHookTypesResponse)
-> Lens
     DescribeLifecycleHookTypesResponse
     DescribeLifecycleHookTypesResponse
     Int
     Int
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