{-# 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.AutoScalingPlans.DescribeScalingPlanResources
-- 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 scalable resources in the specified scaling plan.
--
-- This operation returns paginated results.
module Amazonka.AutoScalingPlans.DescribeScalingPlanResources
  ( -- * Creating a Request
    DescribeScalingPlanResources (..),
    newDescribeScalingPlanResources,

    -- * Request Lenses
    describeScalingPlanResources_nextToken,
    describeScalingPlanResources_maxResults,
    describeScalingPlanResources_scalingPlanName,
    describeScalingPlanResources_scalingPlanVersion,

    -- * Destructuring the Response
    DescribeScalingPlanResourcesResponse (..),
    newDescribeScalingPlanResourcesResponse,

    -- * Response Lenses
    describeScalingPlanResourcesResponse_nextToken,
    describeScalingPlanResourcesResponse_scalingPlanResources,
    describeScalingPlanResourcesResponse_httpStatus,
  )
where

import Amazonka.AutoScalingPlans.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:/ 'newDescribeScalingPlanResources' smart constructor.
data DescribeScalingPlanResources = DescribeScalingPlanResources'
  { -- | The token for the next set of results.
    DescribeScalingPlanResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of scalable resources to return. The value must be
    -- between 1 and 50. The default value is 50.
    DescribeScalingPlanResources -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The name of the scaling plan.
    DescribeScalingPlanResources -> Text
scalingPlanName :: Prelude.Text,
    -- | The version number of the scaling plan. Currently, the only valid value
    -- is @1@.
    DescribeScalingPlanResources -> Integer
scalingPlanVersion :: Prelude.Integer
  }
  deriving (DescribeScalingPlanResources
-> DescribeScalingPlanResources -> Bool
(DescribeScalingPlanResources
 -> DescribeScalingPlanResources -> Bool)
-> (DescribeScalingPlanResources
    -> DescribeScalingPlanResources -> Bool)
-> Eq DescribeScalingPlanResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeScalingPlanResources
-> DescribeScalingPlanResources -> Bool
$c/= :: DescribeScalingPlanResources
-> DescribeScalingPlanResources -> Bool
== :: DescribeScalingPlanResources
-> DescribeScalingPlanResources -> Bool
$c== :: DescribeScalingPlanResources
-> DescribeScalingPlanResources -> Bool
Prelude.Eq, ReadPrec [DescribeScalingPlanResources]
ReadPrec DescribeScalingPlanResources
Int -> ReadS DescribeScalingPlanResources
ReadS [DescribeScalingPlanResources]
(Int -> ReadS DescribeScalingPlanResources)
-> ReadS [DescribeScalingPlanResources]
-> ReadPrec DescribeScalingPlanResources
-> ReadPrec [DescribeScalingPlanResources]
-> Read DescribeScalingPlanResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeScalingPlanResources]
$creadListPrec :: ReadPrec [DescribeScalingPlanResources]
readPrec :: ReadPrec DescribeScalingPlanResources
$creadPrec :: ReadPrec DescribeScalingPlanResources
readList :: ReadS [DescribeScalingPlanResources]
$creadList :: ReadS [DescribeScalingPlanResources]
readsPrec :: Int -> ReadS DescribeScalingPlanResources
$creadsPrec :: Int -> ReadS DescribeScalingPlanResources
Prelude.Read, Int -> DescribeScalingPlanResources -> ShowS
[DescribeScalingPlanResources] -> ShowS
DescribeScalingPlanResources -> String
(Int -> DescribeScalingPlanResources -> ShowS)
-> (DescribeScalingPlanResources -> String)
-> ([DescribeScalingPlanResources] -> ShowS)
-> Show DescribeScalingPlanResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeScalingPlanResources] -> ShowS
$cshowList :: [DescribeScalingPlanResources] -> ShowS
show :: DescribeScalingPlanResources -> String
$cshow :: DescribeScalingPlanResources -> String
showsPrec :: Int -> DescribeScalingPlanResources -> ShowS
$cshowsPrec :: Int -> DescribeScalingPlanResources -> ShowS
Prelude.Show, (forall x.
 DescribeScalingPlanResources -> Rep DescribeScalingPlanResources x)
-> (forall x.
    Rep DescribeScalingPlanResources x -> DescribeScalingPlanResources)
-> Generic DescribeScalingPlanResources
forall x.
Rep DescribeScalingPlanResources x -> DescribeScalingPlanResources
forall x.
DescribeScalingPlanResources -> Rep DescribeScalingPlanResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeScalingPlanResources x -> DescribeScalingPlanResources
$cfrom :: forall x.
DescribeScalingPlanResources -> Rep DescribeScalingPlanResources x
Prelude.Generic)

-- |
-- Create a value of 'DescribeScalingPlanResources' 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:
--
-- 'nextToken', 'describeScalingPlanResources_nextToken' - The token for the next set of results.
--
-- 'maxResults', 'describeScalingPlanResources_maxResults' - The maximum number of scalable resources to return. The value must be
-- between 1 and 50. The default value is 50.
--
-- 'scalingPlanName', 'describeScalingPlanResources_scalingPlanName' - The name of the scaling plan.
--
-- 'scalingPlanVersion', 'describeScalingPlanResources_scalingPlanVersion' - The version number of the scaling plan. Currently, the only valid value
-- is @1@.
newDescribeScalingPlanResources ::
  -- | 'scalingPlanName'
  Prelude.Text ->
  -- | 'scalingPlanVersion'
  Prelude.Integer ->
  DescribeScalingPlanResources
newDescribeScalingPlanResources :: Text -> Integer -> DescribeScalingPlanResources
newDescribeScalingPlanResources
  Text
pScalingPlanName_
  Integer
pScalingPlanVersion_ =
    DescribeScalingPlanResources' :: Maybe Text
-> Maybe Int -> Text -> Integer -> DescribeScalingPlanResources
DescribeScalingPlanResources'
      { $sel:nextToken:DescribeScalingPlanResources' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:DescribeScalingPlanResources' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:scalingPlanName:DescribeScalingPlanResources' :: Text
scalingPlanName = Text
pScalingPlanName_,
        $sel:scalingPlanVersion:DescribeScalingPlanResources' :: Integer
scalingPlanVersion = Integer
pScalingPlanVersion_
      }

-- | The token for the next set of results.
describeScalingPlanResources_nextToken :: Lens.Lens' DescribeScalingPlanResources (Prelude.Maybe Prelude.Text)
describeScalingPlanResources_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeScalingPlanResources -> f DescribeScalingPlanResources
describeScalingPlanResources_nextToken = (DescribeScalingPlanResources -> Maybe Text)
-> (DescribeScalingPlanResources
    -> Maybe Text -> DescribeScalingPlanResources)
-> Lens
     DescribeScalingPlanResources
     DescribeScalingPlanResources
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingPlanResources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeScalingPlanResources
s@DescribeScalingPlanResources' {} Maybe Text
a -> DescribeScalingPlanResources
s {$sel:nextToken:DescribeScalingPlanResources' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeScalingPlanResources)

-- | The maximum number of scalable resources to return. The value must be
-- between 1 and 50. The default value is 50.
describeScalingPlanResources_maxResults :: Lens.Lens' DescribeScalingPlanResources (Prelude.Maybe Prelude.Int)
describeScalingPlanResources_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeScalingPlanResources -> f DescribeScalingPlanResources
describeScalingPlanResources_maxResults = (DescribeScalingPlanResources -> Maybe Int)
-> (DescribeScalingPlanResources
    -> Maybe Int -> DescribeScalingPlanResources)
-> Lens
     DescribeScalingPlanResources
     DescribeScalingPlanResources
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingPlanResources' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeScalingPlanResources
s@DescribeScalingPlanResources' {} Maybe Int
a -> DescribeScalingPlanResources
s {$sel:maxResults:DescribeScalingPlanResources' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeScalingPlanResources)

-- | The name of the scaling plan.
describeScalingPlanResources_scalingPlanName :: Lens.Lens' DescribeScalingPlanResources Prelude.Text
describeScalingPlanResources_scalingPlanName :: (Text -> f Text)
-> DescribeScalingPlanResources -> f DescribeScalingPlanResources
describeScalingPlanResources_scalingPlanName = (DescribeScalingPlanResources -> Text)
-> (DescribeScalingPlanResources
    -> Text -> DescribeScalingPlanResources)
-> Lens
     DescribeScalingPlanResources DescribeScalingPlanResources Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingPlanResources' {Text
scalingPlanName :: Text
$sel:scalingPlanName:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Text
scalingPlanName} -> Text
scalingPlanName) (\s :: DescribeScalingPlanResources
s@DescribeScalingPlanResources' {} Text
a -> DescribeScalingPlanResources
s {$sel:scalingPlanName:DescribeScalingPlanResources' :: Text
scalingPlanName = Text
a} :: DescribeScalingPlanResources)

-- | The version number of the scaling plan. Currently, the only valid value
-- is @1@.
describeScalingPlanResources_scalingPlanVersion :: Lens.Lens' DescribeScalingPlanResources Prelude.Integer
describeScalingPlanResources_scalingPlanVersion :: (Integer -> f Integer)
-> DescribeScalingPlanResources -> f DescribeScalingPlanResources
describeScalingPlanResources_scalingPlanVersion = (DescribeScalingPlanResources -> Integer)
-> (DescribeScalingPlanResources
    -> Integer -> DescribeScalingPlanResources)
-> Lens
     DescribeScalingPlanResources
     DescribeScalingPlanResources
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingPlanResources' {Integer
scalingPlanVersion :: Integer
$sel:scalingPlanVersion:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Integer
scalingPlanVersion} -> Integer
scalingPlanVersion) (\s :: DescribeScalingPlanResources
s@DescribeScalingPlanResources' {} Integer
a -> DescribeScalingPlanResources
s {$sel:scalingPlanVersion:DescribeScalingPlanResources' :: Integer
scalingPlanVersion = Integer
a} :: DescribeScalingPlanResources)

instance Core.AWSPager DescribeScalingPlanResources where
  page :: DescribeScalingPlanResources
-> AWSResponse DescribeScalingPlanResources
-> Maybe DescribeScalingPlanResources
page DescribeScalingPlanResources
rq AWSResponse DescribeScalingPlanResources
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeScalingPlanResources
DescribeScalingPlanResourcesResponse
rs
            DescribeScalingPlanResourcesResponse
-> Getting (First Text) DescribeScalingPlanResourcesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeScalingPlanResourcesResponse
-> Const (First Text) DescribeScalingPlanResourcesResponse
Lens' DescribeScalingPlanResourcesResponse (Maybe Text)
describeScalingPlanResourcesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeScalingPlanResourcesResponse
 -> Const (First Text) DescribeScalingPlanResourcesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeScalingPlanResourcesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeScalingPlanResources
forall a. Maybe a
Prelude.Nothing
    | Maybe [ScalingPlanResource] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeScalingPlanResources
DescribeScalingPlanResourcesResponse
rs
            DescribeScalingPlanResourcesResponse
-> Getting
     (First [ScalingPlanResource])
     DescribeScalingPlanResourcesResponse
     [ScalingPlanResource]
-> Maybe [ScalingPlanResource]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ScalingPlanResource]
 -> Const
      (First [ScalingPlanResource]) (Maybe [ScalingPlanResource]))
-> DescribeScalingPlanResourcesResponse
-> Const
     (First [ScalingPlanResource]) DescribeScalingPlanResourcesResponse
Lens'
  DescribeScalingPlanResourcesResponse (Maybe [ScalingPlanResource])
describeScalingPlanResourcesResponse_scalingPlanResources
              ((Maybe [ScalingPlanResource]
  -> Const
       (First [ScalingPlanResource]) (Maybe [ScalingPlanResource]))
 -> DescribeScalingPlanResourcesResponse
 -> Const
      (First [ScalingPlanResource]) DescribeScalingPlanResourcesResponse)
-> (([ScalingPlanResource]
     -> Const (First [ScalingPlanResource]) [ScalingPlanResource])
    -> Maybe [ScalingPlanResource]
    -> Const
         (First [ScalingPlanResource]) (Maybe [ScalingPlanResource]))
-> Getting
     (First [ScalingPlanResource])
     DescribeScalingPlanResourcesResponse
     [ScalingPlanResource]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ScalingPlanResource]
 -> Const (First [ScalingPlanResource]) [ScalingPlanResource])
-> Maybe [ScalingPlanResource]
-> Const
     (First [ScalingPlanResource]) (Maybe [ScalingPlanResource])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeScalingPlanResources
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeScalingPlanResources -> Maybe DescribeScalingPlanResources
forall a. a -> Maybe a
Prelude.Just (DescribeScalingPlanResources
 -> Maybe DescribeScalingPlanResources)
-> DescribeScalingPlanResources
-> Maybe DescribeScalingPlanResources
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeScalingPlanResources
rq
          DescribeScalingPlanResources
-> (DescribeScalingPlanResources -> DescribeScalingPlanResources)
-> DescribeScalingPlanResources
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeScalingPlanResources
-> Identity DescribeScalingPlanResources
Lens
  DescribeScalingPlanResources
  DescribeScalingPlanResources
  (Maybe Text)
  (Maybe Text)
describeScalingPlanResources_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeScalingPlanResources
 -> Identity DescribeScalingPlanResources)
-> Maybe Text
-> DescribeScalingPlanResources
-> DescribeScalingPlanResources
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeScalingPlanResources
DescribeScalingPlanResourcesResponse
rs
          DescribeScalingPlanResourcesResponse
-> Getting (First Text) DescribeScalingPlanResourcesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeScalingPlanResourcesResponse
-> Const (First Text) DescribeScalingPlanResourcesResponse
Lens' DescribeScalingPlanResourcesResponse (Maybe Text)
describeScalingPlanResourcesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeScalingPlanResourcesResponse
 -> Const (First Text) DescribeScalingPlanResourcesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeScalingPlanResourcesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeScalingPlanResources where
  type
    AWSResponse DescribeScalingPlanResources =
      DescribeScalingPlanResourcesResponse
  request :: DescribeScalingPlanResources
-> Request DescribeScalingPlanResources
request = Service
-> DescribeScalingPlanResources
-> Request DescribeScalingPlanResources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeScalingPlanResources
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeScalingPlanResources)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeScalingPlanResources))
-> Logger
-> Service
-> Proxy DescribeScalingPlanResources
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeScalingPlanResources)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ScalingPlanResource]
-> Int
-> DescribeScalingPlanResourcesResponse
DescribeScalingPlanResourcesResponse'
            (Maybe Text
 -> Maybe [ScalingPlanResource]
 -> Int
 -> DescribeScalingPlanResourcesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ScalingPlanResource]
      -> Int -> DescribeScalingPlanResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Maybe [ScalingPlanResource]
   -> Int -> DescribeScalingPlanResourcesResponse)
-> Either String (Maybe [ScalingPlanResource])
-> Either String (Int -> DescribeScalingPlanResourcesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [ScalingPlanResource]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ScalingPlanResources"
                            Either String (Maybe (Maybe [ScalingPlanResource]))
-> Maybe [ScalingPlanResource]
-> Either String (Maybe [ScalingPlanResource])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ScalingPlanResource]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> DescribeScalingPlanResourcesResponse)
-> Either String Int
-> Either String DescribeScalingPlanResourcesResponse
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
    DescribeScalingPlanResources

instance Prelude.NFData DescribeScalingPlanResources

instance Core.ToHeaders DescribeScalingPlanResources where
  toHeaders :: DescribeScalingPlanResources -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeScalingPlanResources -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AnyScaleScalingPlannerFrontendService.DescribeScalingPlanResources" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeScalingPlanResources where
  toJSON :: DescribeScalingPlanResources -> Value
toJSON DescribeScalingPlanResources' {Integer
Maybe Int
Maybe Text
Text
scalingPlanVersion :: Integer
scalingPlanName :: Text
maxResults :: Maybe Int
nextToken :: Maybe Text
$sel:scalingPlanVersion:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Integer
$sel:scalingPlanName:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Text
$sel:maxResults:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Maybe Int
$sel:nextToken:DescribeScalingPlanResources' :: DescribeScalingPlanResources -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ScalingPlanName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
scalingPlanName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ScalingPlanVersion" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
scalingPlanVersion)
          ]
      )

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

instance Core.ToQuery DescribeScalingPlanResources where
  toQuery :: DescribeScalingPlanResources -> QueryString
toQuery = QueryString -> DescribeScalingPlanResources -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeScalingPlanResourcesResponse' smart constructor.
data DescribeScalingPlanResourcesResponse = DescribeScalingPlanResourcesResponse'
  { -- | The token required to get the next set of results. This value is @null@
    -- if there are no more results to return.
    DescribeScalingPlanResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the scalable resources.
    DescribeScalingPlanResourcesResponse -> Maybe [ScalingPlanResource]
scalingPlanResources :: Prelude.Maybe [ScalingPlanResource],
    -- | The response's http status code.
    DescribeScalingPlanResourcesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeScalingPlanResourcesResponse
-> DescribeScalingPlanResourcesResponse -> Bool
(DescribeScalingPlanResourcesResponse
 -> DescribeScalingPlanResourcesResponse -> Bool)
-> (DescribeScalingPlanResourcesResponse
    -> DescribeScalingPlanResourcesResponse -> Bool)
-> Eq DescribeScalingPlanResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeScalingPlanResourcesResponse
-> DescribeScalingPlanResourcesResponse -> Bool
$c/= :: DescribeScalingPlanResourcesResponse
-> DescribeScalingPlanResourcesResponse -> Bool
== :: DescribeScalingPlanResourcesResponse
-> DescribeScalingPlanResourcesResponse -> Bool
$c== :: DescribeScalingPlanResourcesResponse
-> DescribeScalingPlanResourcesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeScalingPlanResourcesResponse]
ReadPrec DescribeScalingPlanResourcesResponse
Int -> ReadS DescribeScalingPlanResourcesResponse
ReadS [DescribeScalingPlanResourcesResponse]
(Int -> ReadS DescribeScalingPlanResourcesResponse)
-> ReadS [DescribeScalingPlanResourcesResponse]
-> ReadPrec DescribeScalingPlanResourcesResponse
-> ReadPrec [DescribeScalingPlanResourcesResponse]
-> Read DescribeScalingPlanResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeScalingPlanResourcesResponse]
$creadListPrec :: ReadPrec [DescribeScalingPlanResourcesResponse]
readPrec :: ReadPrec DescribeScalingPlanResourcesResponse
$creadPrec :: ReadPrec DescribeScalingPlanResourcesResponse
readList :: ReadS [DescribeScalingPlanResourcesResponse]
$creadList :: ReadS [DescribeScalingPlanResourcesResponse]
readsPrec :: Int -> ReadS DescribeScalingPlanResourcesResponse
$creadsPrec :: Int -> ReadS DescribeScalingPlanResourcesResponse
Prelude.Read, Int -> DescribeScalingPlanResourcesResponse -> ShowS
[DescribeScalingPlanResourcesResponse] -> ShowS
DescribeScalingPlanResourcesResponse -> String
(Int -> DescribeScalingPlanResourcesResponse -> ShowS)
-> (DescribeScalingPlanResourcesResponse -> String)
-> ([DescribeScalingPlanResourcesResponse] -> ShowS)
-> Show DescribeScalingPlanResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeScalingPlanResourcesResponse] -> ShowS
$cshowList :: [DescribeScalingPlanResourcesResponse] -> ShowS
show :: DescribeScalingPlanResourcesResponse -> String
$cshow :: DescribeScalingPlanResourcesResponse -> String
showsPrec :: Int -> DescribeScalingPlanResourcesResponse -> ShowS
$cshowsPrec :: Int -> DescribeScalingPlanResourcesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeScalingPlanResourcesResponse
 -> Rep DescribeScalingPlanResourcesResponse x)
-> (forall x.
    Rep DescribeScalingPlanResourcesResponse x
    -> DescribeScalingPlanResourcesResponse)
-> Generic DescribeScalingPlanResourcesResponse
forall x.
Rep DescribeScalingPlanResourcesResponse x
-> DescribeScalingPlanResourcesResponse
forall x.
DescribeScalingPlanResourcesResponse
-> Rep DescribeScalingPlanResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeScalingPlanResourcesResponse x
-> DescribeScalingPlanResourcesResponse
$cfrom :: forall x.
DescribeScalingPlanResourcesResponse
-> Rep DescribeScalingPlanResourcesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeScalingPlanResourcesResponse' 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:
--
-- 'nextToken', 'describeScalingPlanResourcesResponse_nextToken' - The token required to get the next set of results. This value is @null@
-- if there are no more results to return.
--
-- 'scalingPlanResources', 'describeScalingPlanResourcesResponse_scalingPlanResources' - Information about the scalable resources.
--
-- 'httpStatus', 'describeScalingPlanResourcesResponse_httpStatus' - The response's http status code.
newDescribeScalingPlanResourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeScalingPlanResourcesResponse
newDescribeScalingPlanResourcesResponse :: Int -> DescribeScalingPlanResourcesResponse
newDescribeScalingPlanResourcesResponse Int
pHttpStatus_ =
  DescribeScalingPlanResourcesResponse' :: Maybe Text
-> Maybe [ScalingPlanResource]
-> Int
-> DescribeScalingPlanResourcesResponse
DescribeScalingPlanResourcesResponse'
    { $sel:nextToken:DescribeScalingPlanResourcesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scalingPlanResources:DescribeScalingPlanResourcesResponse' :: Maybe [ScalingPlanResource]
scalingPlanResources =
        Maybe [ScalingPlanResource]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeScalingPlanResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token required to get the next set of results. This value is @null@
-- if there are no more results to return.
describeScalingPlanResourcesResponse_nextToken :: Lens.Lens' DescribeScalingPlanResourcesResponse (Prelude.Maybe Prelude.Text)
describeScalingPlanResourcesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeScalingPlanResourcesResponse
-> f DescribeScalingPlanResourcesResponse
describeScalingPlanResourcesResponse_nextToken = (DescribeScalingPlanResourcesResponse -> Maybe Text)
-> (DescribeScalingPlanResourcesResponse
    -> Maybe Text -> DescribeScalingPlanResourcesResponse)
-> Lens' DescribeScalingPlanResourcesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingPlanResourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeScalingPlanResourcesResponse' :: DescribeScalingPlanResourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeScalingPlanResourcesResponse
s@DescribeScalingPlanResourcesResponse' {} Maybe Text
a -> DescribeScalingPlanResourcesResponse
s {$sel:nextToken:DescribeScalingPlanResourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeScalingPlanResourcesResponse)

-- | Information about the scalable resources.
describeScalingPlanResourcesResponse_scalingPlanResources :: Lens.Lens' DescribeScalingPlanResourcesResponse (Prelude.Maybe [ScalingPlanResource])
describeScalingPlanResourcesResponse_scalingPlanResources :: (Maybe [ScalingPlanResource] -> f (Maybe [ScalingPlanResource]))
-> DescribeScalingPlanResourcesResponse
-> f DescribeScalingPlanResourcesResponse
describeScalingPlanResourcesResponse_scalingPlanResources = (DescribeScalingPlanResourcesResponse
 -> Maybe [ScalingPlanResource])
-> (DescribeScalingPlanResourcesResponse
    -> Maybe [ScalingPlanResource]
    -> DescribeScalingPlanResourcesResponse)
-> Lens'
     DescribeScalingPlanResourcesResponse (Maybe [ScalingPlanResource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScalingPlanResourcesResponse' {Maybe [ScalingPlanResource]
scalingPlanResources :: Maybe [ScalingPlanResource]
$sel:scalingPlanResources:DescribeScalingPlanResourcesResponse' :: DescribeScalingPlanResourcesResponse -> Maybe [ScalingPlanResource]
scalingPlanResources} -> Maybe [ScalingPlanResource]
scalingPlanResources) (\s :: DescribeScalingPlanResourcesResponse
s@DescribeScalingPlanResourcesResponse' {} Maybe [ScalingPlanResource]
a -> DescribeScalingPlanResourcesResponse
s {$sel:scalingPlanResources:DescribeScalingPlanResourcesResponse' :: Maybe [ScalingPlanResource]
scalingPlanResources = Maybe [ScalingPlanResource]
a} :: DescribeScalingPlanResourcesResponse) ((Maybe [ScalingPlanResource] -> f (Maybe [ScalingPlanResource]))
 -> DescribeScalingPlanResourcesResponse
 -> f DescribeScalingPlanResourcesResponse)
-> ((Maybe [ScalingPlanResource]
     -> f (Maybe [ScalingPlanResource]))
    -> Maybe [ScalingPlanResource] -> f (Maybe [ScalingPlanResource]))
-> (Maybe [ScalingPlanResource] -> f (Maybe [ScalingPlanResource]))
-> DescribeScalingPlanResourcesResponse
-> f DescribeScalingPlanResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ScalingPlanResource]
  [ScalingPlanResource]
  [ScalingPlanResource]
  [ScalingPlanResource]
-> Iso
     (Maybe [ScalingPlanResource])
     (Maybe [ScalingPlanResource])
     (Maybe [ScalingPlanResource])
     (Maybe [ScalingPlanResource])
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
  [ScalingPlanResource]
  [ScalingPlanResource]
  [ScalingPlanResource]
  [ScalingPlanResource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeScalingPlanResourcesResponse