{-# 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.DescribeScalingProcessTypes
-- 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 scaling process types for use with the ResumeProcesses and
-- SuspendProcesses APIs.
module Amazonka.AutoScaling.DescribeScalingProcessTypes
  ( -- * Creating a Request
    DescribeScalingProcessTypes (..),
    newDescribeScalingProcessTypes,

    -- * Destructuring the Response
    DescribeScalingProcessTypesResponse (..),
    newDescribeScalingProcessTypesResponse,

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

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

instance Core.AWSRequest DescribeScalingProcessTypes where
  type
    AWSResponse DescribeScalingProcessTypes =
      DescribeScalingProcessTypesResponse
  request :: (Service -> Service)
-> DescribeScalingProcessTypes
-> Request DescribeScalingProcessTypes
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 DescribeScalingProcessTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeScalingProcessTypes)))
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
"DescribeScalingProcessTypesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [ProcessType] -> Int -> DescribeScalingProcessTypesResponse
DescribeScalingProcessTypesResponse'
            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
"Processes"
                            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 DescribeScalingProcessTypes where
  hashWithSalt :: Int -> DescribeScalingProcessTypes -> Int
hashWithSalt Int
_salt DescribeScalingProcessTypes
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

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

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

instance Data.ToQuery DescribeScalingProcessTypes where
  toQuery :: DescribeScalingProcessTypes -> 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
"DescribeScalingProcessTypes" ::
                          Prelude.ByteString
                      ),
            ByteString
"Version"
              forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2011-01-01" :: Prelude.ByteString)
          ]
      )

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

-- |
-- Create a value of 'DescribeScalingProcessTypesResponse' 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:
--
-- 'processes', 'describeScalingProcessTypesResponse_processes' - The names of the process types.
--
-- 'httpStatus', 'describeScalingProcessTypesResponse_httpStatus' - The response's http status code.
newDescribeScalingProcessTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeScalingProcessTypesResponse
newDescribeScalingProcessTypesResponse :: Int -> DescribeScalingProcessTypesResponse
newDescribeScalingProcessTypesResponse Int
pHttpStatus_ =
  DescribeScalingProcessTypesResponse'
    { $sel:processes:DescribeScalingProcessTypesResponse' :: Maybe [ProcessType]
processes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeScalingProcessTypesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The names of the process types.
describeScalingProcessTypesResponse_processes :: Lens.Lens' DescribeScalingProcessTypesResponse (Prelude.Maybe [ProcessType])
describeScalingProcessTypesResponse_processes :: Lens' DescribeScalingProcessTypesResponse (Maybe [ProcessType])
describeScalingProcessTypesResponse_processes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingProcessTypesResponse' {Maybe [ProcessType]
processes :: Maybe [ProcessType]
$sel:processes:DescribeScalingProcessTypesResponse' :: DescribeScalingProcessTypesResponse -> Maybe [ProcessType]
processes} -> Maybe [ProcessType]
processes) (\s :: DescribeScalingProcessTypesResponse
s@DescribeScalingProcessTypesResponse' {} Maybe [ProcessType]
a -> DescribeScalingProcessTypesResponse
s {$sel:processes:DescribeScalingProcessTypesResponse' :: Maybe [ProcessType]
processes = Maybe [ProcessType]
a} :: DescribeScalingProcessTypesResponse) 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.
describeScalingProcessTypesResponse_httpStatus :: Lens.Lens' DescribeScalingProcessTypesResponse Prelude.Int
describeScalingProcessTypesResponse_httpStatus :: Lens' DescribeScalingProcessTypesResponse Int
describeScalingProcessTypesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingProcessTypesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeScalingProcessTypesResponse' :: DescribeScalingProcessTypesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeScalingProcessTypesResponse
s@DescribeScalingProcessTypesResponse' {} Int
a -> DescribeScalingProcessTypesResponse
s {$sel:httpStatus:DescribeScalingProcessTypesResponse' :: Int
httpStatus = Int
a} :: DescribeScalingProcessTypesResponse)

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