{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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:/ 'newDescribeAdjustmentTypes' smart constructor.
data DescribeAdjustmentTypes = DescribeAdjustmentTypes'
  {
  }
  deriving (DescribeAdjustmentTypes -> DescribeAdjustmentTypes -> Bool
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]
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
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. 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 :: (Service -> Service)
-> DescribeAdjustmentTypes -> Request DescribeAdjustmentTypes
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 DescribeAdjustmentTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAdjustmentTypes)))
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
"DescribeAdjustmentTypesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [AdjustmentType] -> Int -> DescribeAdjustmentTypesResponse
DescribeAdjustmentTypesResponse'
            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
"AdjustmentTypes"
                            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 DescribeAdjustmentTypes where
  hashWithSalt :: Int -> DescribeAdjustmentTypes -> Int
hashWithSalt Int
_salt DescribeAdjustmentTypes
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

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

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

instance Data.ToQuery DescribeAdjustmentTypes where
  toQuery :: DescribeAdjustmentTypes -> 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
"DescribeAdjustmentTypes" :: Prelude.ByteString),
            ByteString
"Version"
              forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (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
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]
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
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.
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'
    { $sel:adjustmentTypes:DescribeAdjustmentTypesResponse' :: Maybe [AdjustmentType]
adjustmentTypes =
        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 :: Lens' DescribeAdjustmentTypesResponse (Maybe [AdjustmentType])
describeAdjustmentTypesResponse_adjustmentTypes = 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) 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.
describeAdjustmentTypesResponse_httpStatus :: Lens.Lens' DescribeAdjustmentTypesResponse Prelude.Int
describeAdjustmentTypesResponse_httpStatus :: Lens' DescribeAdjustmentTypesResponse Int
describeAdjustmentTypesResponse_httpStatus = 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
  where
  rnf :: DescribeAdjustmentTypesResponse -> ()
rnf DescribeAdjustmentTypesResponse' {Int
Maybe [AdjustmentType]
httpStatus :: Int
adjustmentTypes :: Maybe [AdjustmentType]
$sel:httpStatus:DescribeAdjustmentTypesResponse' :: DescribeAdjustmentTypesResponse -> Int
$sel:adjustmentTypes:DescribeAdjustmentTypesResponse' :: DescribeAdjustmentTypesResponse -> Maybe [AdjustmentType]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AdjustmentType]
adjustmentTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus