{-# 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-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 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.Lens as Lens
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
(DescribeScalingProcessTypes
 -> DescribeScalingProcessTypes -> Bool)
-> (DescribeScalingProcessTypes
    -> DescribeScalingProcessTypes -> Bool)
-> Eq DescribeScalingProcessTypes
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]
(Int -> ReadS DescribeScalingProcessTypes)
-> ReadS [DescribeScalingProcessTypes]
-> ReadPrec DescribeScalingProcessTypes
-> ReadPrec [DescribeScalingProcessTypes]
-> Read 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
(Int -> DescribeScalingProcessTypes -> ShowS)
-> (DescribeScalingProcessTypes -> String)
-> ([DescribeScalingProcessTypes] -> ShowS)
-> Show DescribeScalingProcessTypes
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.
 DescribeScalingProcessTypes -> Rep DescribeScalingProcessTypes x)
-> (forall x.
    Rep DescribeScalingProcessTypes x -> DescribeScalingProcessTypes)
-> Generic DescribeScalingProcessTypes
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 :: DescribeScalingProcessTypes -> Request DescribeScalingProcessTypes
request = Service
-> DescribeScalingProcessTypes
-> Request DescribeScalingProcessTypes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeScalingProcessTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeScalingProcessTypes)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeScalingProcessTypes))
-> Logger
-> Service
-> Proxy DescribeScalingProcessTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeScalingProcessTypes)))
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
"DescribeScalingProcessTypesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [ProcessType] -> Int -> DescribeScalingProcessTypesResponse
DescribeScalingProcessTypesResponse'
            (Maybe [ProcessType] -> Int -> DescribeScalingProcessTypesResponse)
-> Either String (Maybe [ProcessType])
-> Either String (Int -> DescribeScalingProcessTypesResponse)
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
"Processes" 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 [ProcessType]))
-> Either String (Maybe [ProcessType])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ProcessType])
-> [Node] -> Either String (Maybe [ProcessType])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ProcessType]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> DescribeScalingProcessTypesResponse)
-> Either String Int
-> Either String DescribeScalingProcessTypesResponse
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 DescribeScalingProcessTypes

instance Prelude.NFData DescribeScalingProcessTypes

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

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

instance Core.ToQuery DescribeScalingProcessTypes where
  toQuery :: DescribeScalingProcessTypes -> QueryString
toQuery =
    QueryString -> DescribeScalingProcessTypes -> 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
"DescribeScalingProcessTypes" ::
                          Prelude.ByteString
                      ),
            ByteString
"Version"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (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
(DescribeScalingProcessTypesResponse
 -> DescribeScalingProcessTypesResponse -> Bool)
-> (DescribeScalingProcessTypesResponse
    -> DescribeScalingProcessTypesResponse -> Bool)
-> Eq DescribeScalingProcessTypesResponse
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]
(Int -> ReadS DescribeScalingProcessTypesResponse)
-> ReadS [DescribeScalingProcessTypesResponse]
-> ReadPrec DescribeScalingProcessTypesResponse
-> ReadPrec [DescribeScalingProcessTypesResponse]
-> Read 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
(Int -> DescribeScalingProcessTypesResponse -> ShowS)
-> (DescribeScalingProcessTypesResponse -> String)
-> ([DescribeScalingProcessTypesResponse] -> ShowS)
-> Show DescribeScalingProcessTypesResponse
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.
 DescribeScalingProcessTypesResponse
 -> Rep DescribeScalingProcessTypesResponse x)
-> (forall x.
    Rep DescribeScalingProcessTypesResponse x
    -> DescribeScalingProcessTypesResponse)
-> Generic DescribeScalingProcessTypesResponse
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' :: Maybe [ProcessType] -> Int -> DescribeScalingProcessTypesResponse
DescribeScalingProcessTypesResponse'
    { $sel:processes:DescribeScalingProcessTypesResponse' :: Maybe [ProcessType]
processes =
        Maybe [ProcessType]
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 :: (Maybe [ProcessType] -> f (Maybe [ProcessType]))
-> DescribeScalingProcessTypesResponse
-> f DescribeScalingProcessTypesResponse
describeScalingProcessTypesResponse_processes = (DescribeScalingProcessTypesResponse -> Maybe [ProcessType])
-> (DescribeScalingProcessTypesResponse
    -> Maybe [ProcessType] -> DescribeScalingProcessTypesResponse)
-> Lens
     DescribeScalingProcessTypesResponse
     DescribeScalingProcessTypesResponse
     (Maybe [ProcessType])
     (Maybe [ProcessType])
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) ((Maybe [ProcessType] -> f (Maybe [ProcessType]))
 -> DescribeScalingProcessTypesResponse
 -> f DescribeScalingProcessTypesResponse)
-> ((Maybe [ProcessType] -> f (Maybe [ProcessType]))
    -> Maybe [ProcessType] -> f (Maybe [ProcessType]))
-> (Maybe [ProcessType] -> f (Maybe [ProcessType]))
-> DescribeScalingProcessTypesResponse
-> f DescribeScalingProcessTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ProcessType] [ProcessType] [ProcessType] [ProcessType]
-> Iso
     (Maybe [ProcessType])
     (Maybe [ProcessType])
     (Maybe [ProcessType])
     (Maybe [ProcessType])
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 [ProcessType] [ProcessType] [ProcessType] [ProcessType]
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 :: (Int -> f Int)
-> DescribeScalingProcessTypesResponse
-> f DescribeScalingProcessTypesResponse
describeScalingProcessTypesResponse_httpStatus = (DescribeScalingProcessTypesResponse -> Int)
-> (DescribeScalingProcessTypesResponse
    -> Int -> DescribeScalingProcessTypesResponse)
-> Lens
     DescribeScalingProcessTypesResponse
     DescribeScalingProcessTypesResponse
     Int
     Int
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