{-# 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.DescribeAdjustmentTypes
-- 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 adjustment types for step scaling and simple
-- scaling policies.
--
-- The following adjustment types are supported:
--
-- -   @ChangeInCapacity@
--
-- -   @ExactCapacity@
--
-- -   @PercentChangeInCapacity@
module Amazonka.AutoScaling.DescribeAdjustmentTypes
  ( -- * Creating a Request
    DescribeAdjustmentTypes (..),
    newDescribeAdjustmentTypes,

    -- * Destructuring the Response
    DescribeAdjustmentTypesResponse (..),
    newDescribeAdjustmentTypesResponse,

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

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

instance Core.AWSRequest DescribeAdjustmentTypes where
  type
    AWSResponse DescribeAdjustmentTypes =
      DescribeAdjustmentTypesResponse
  request :: DescribeAdjustmentTypes -> Request DescribeAdjustmentTypes
request = Service
-> DescribeAdjustmentTypes -> Request DescribeAdjustmentTypes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAdjustmentTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAdjustmentTypes)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeAdjustmentTypes))
-> Logger
-> Service
-> Proxy DescribeAdjustmentTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAdjustmentTypes)))
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
"DescribeAdjustmentTypesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [AdjustmentType] -> Int -> DescribeAdjustmentTypesResponse
DescribeAdjustmentTypesResponse'
            (Maybe [AdjustmentType] -> Int -> DescribeAdjustmentTypesResponse)
-> Either String (Maybe [AdjustmentType])
-> Either String (Int -> DescribeAdjustmentTypesResponse)
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
"AdjustmentTypes" 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 [AdjustmentType]))
-> Either String (Maybe [AdjustmentType])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AdjustmentType])
-> [Node] -> Either String (Maybe [AdjustmentType])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AdjustmentType]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> DescribeAdjustmentTypesResponse)
-> Either String Int
-> Either String DescribeAdjustmentTypesResponse
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 DescribeAdjustmentTypes

instance Prelude.NFData DescribeAdjustmentTypes

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

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

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

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

-- |
-- Create a value of 'DescribeAdjustmentTypesResponse' 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:
--
-- 'adjustmentTypes', 'describeAdjustmentTypesResponse_adjustmentTypes' - The policy adjustment types.
--
-- 'httpStatus', 'describeAdjustmentTypesResponse_httpStatus' - The response's http status code.
newDescribeAdjustmentTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAdjustmentTypesResponse
newDescribeAdjustmentTypesResponse :: Int -> DescribeAdjustmentTypesResponse
newDescribeAdjustmentTypesResponse Int
pHttpStatus_ =
  DescribeAdjustmentTypesResponse' :: Maybe [AdjustmentType] -> Int -> DescribeAdjustmentTypesResponse
DescribeAdjustmentTypesResponse'
    { $sel:adjustmentTypes:DescribeAdjustmentTypesResponse' :: Maybe [AdjustmentType]
adjustmentTypes =
        Maybe [AdjustmentType]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAdjustmentTypesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The policy adjustment types.
describeAdjustmentTypesResponse_adjustmentTypes :: Lens.Lens' DescribeAdjustmentTypesResponse (Prelude.Maybe [AdjustmentType])
describeAdjustmentTypesResponse_adjustmentTypes :: (Maybe [AdjustmentType] -> f (Maybe [AdjustmentType]))
-> DescribeAdjustmentTypesResponse
-> f DescribeAdjustmentTypesResponse
describeAdjustmentTypesResponse_adjustmentTypes = (DescribeAdjustmentTypesResponse -> Maybe [AdjustmentType])
-> (DescribeAdjustmentTypesResponse
    -> Maybe [AdjustmentType] -> DescribeAdjustmentTypesResponse)
-> Lens
     DescribeAdjustmentTypesResponse
     DescribeAdjustmentTypesResponse
     (Maybe [AdjustmentType])
     (Maybe [AdjustmentType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAdjustmentTypesResponse' {Maybe [AdjustmentType]
adjustmentTypes :: Maybe [AdjustmentType]
$sel:adjustmentTypes:DescribeAdjustmentTypesResponse' :: DescribeAdjustmentTypesResponse -> Maybe [AdjustmentType]
adjustmentTypes} -> Maybe [AdjustmentType]
adjustmentTypes) (\s :: DescribeAdjustmentTypesResponse
s@DescribeAdjustmentTypesResponse' {} Maybe [AdjustmentType]
a -> DescribeAdjustmentTypesResponse
s {$sel:adjustmentTypes:DescribeAdjustmentTypesResponse' :: Maybe [AdjustmentType]
adjustmentTypes = Maybe [AdjustmentType]
a} :: DescribeAdjustmentTypesResponse) ((Maybe [AdjustmentType] -> f (Maybe [AdjustmentType]))
 -> DescribeAdjustmentTypesResponse
 -> f DescribeAdjustmentTypesResponse)
-> ((Maybe [AdjustmentType] -> f (Maybe [AdjustmentType]))
    -> Maybe [AdjustmentType] -> f (Maybe [AdjustmentType]))
-> (Maybe [AdjustmentType] -> f (Maybe [AdjustmentType]))
-> DescribeAdjustmentTypesResponse
-> f DescribeAdjustmentTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AdjustmentType] [AdjustmentType] [AdjustmentType] [AdjustmentType]
-> Iso
     (Maybe [AdjustmentType])
     (Maybe [AdjustmentType])
     (Maybe [AdjustmentType])
     (Maybe [AdjustmentType])
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
  [AdjustmentType] [AdjustmentType] [AdjustmentType] [AdjustmentType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAdjustmentTypesResponse