{-# 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.DescribeAutoScalingInstances
-- 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)
--
-- Gets information about the Auto Scaling instances in the account and
-- Region.
--
-- This operation returns paginated results.
module Amazonka.AutoScaling.DescribeAutoScalingInstances
  ( -- * Creating a Request
    DescribeAutoScalingInstances (..),
    newDescribeAutoScalingInstances,

    -- * Request Lenses
    describeAutoScalingInstances_nextToken,
    describeAutoScalingInstances_instanceIds,
    describeAutoScalingInstances_maxRecords,

    -- * Destructuring the Response
    DescribeAutoScalingInstancesResponse (..),
    newDescribeAutoScalingInstancesResponse,

    -- * Response Lenses
    describeAutoScalingInstancesResponse_nextToken,
    describeAutoScalingInstancesResponse_autoScalingInstances,
    describeAutoScalingInstancesResponse_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:/ 'newDescribeAutoScalingInstances' smart constructor.
data DescribeAutoScalingInstances = DescribeAutoScalingInstances'
  { -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeAutoScalingInstances -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The IDs of the instances. If you omit this parameter, all Auto Scaling
    -- instances are described. If you specify an ID that does not exist, it is
    -- ignored with no error.
    --
    -- Array Members: Maximum number of 50 items.
    DescribeAutoScalingInstances -> Maybe [Text]
instanceIds :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of items to return with this call. The default value
    -- is @50@ and the maximum value is @50@.
    DescribeAutoScalingInstances -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeAutoScalingInstances
-> DescribeAutoScalingInstances -> Bool
(DescribeAutoScalingInstances
 -> DescribeAutoScalingInstances -> Bool)
-> (DescribeAutoScalingInstances
    -> DescribeAutoScalingInstances -> Bool)
-> Eq DescribeAutoScalingInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAutoScalingInstances
-> DescribeAutoScalingInstances -> Bool
$c/= :: DescribeAutoScalingInstances
-> DescribeAutoScalingInstances -> Bool
== :: DescribeAutoScalingInstances
-> DescribeAutoScalingInstances -> Bool
$c== :: DescribeAutoScalingInstances
-> DescribeAutoScalingInstances -> Bool
Prelude.Eq, ReadPrec [DescribeAutoScalingInstances]
ReadPrec DescribeAutoScalingInstances
Int -> ReadS DescribeAutoScalingInstances
ReadS [DescribeAutoScalingInstances]
(Int -> ReadS DescribeAutoScalingInstances)
-> ReadS [DescribeAutoScalingInstances]
-> ReadPrec DescribeAutoScalingInstances
-> ReadPrec [DescribeAutoScalingInstances]
-> Read DescribeAutoScalingInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAutoScalingInstances]
$creadListPrec :: ReadPrec [DescribeAutoScalingInstances]
readPrec :: ReadPrec DescribeAutoScalingInstances
$creadPrec :: ReadPrec DescribeAutoScalingInstances
readList :: ReadS [DescribeAutoScalingInstances]
$creadList :: ReadS [DescribeAutoScalingInstances]
readsPrec :: Int -> ReadS DescribeAutoScalingInstances
$creadsPrec :: Int -> ReadS DescribeAutoScalingInstances
Prelude.Read, Int -> DescribeAutoScalingInstances -> ShowS
[DescribeAutoScalingInstances] -> ShowS
DescribeAutoScalingInstances -> String
(Int -> DescribeAutoScalingInstances -> ShowS)
-> (DescribeAutoScalingInstances -> String)
-> ([DescribeAutoScalingInstances] -> ShowS)
-> Show DescribeAutoScalingInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAutoScalingInstances] -> ShowS
$cshowList :: [DescribeAutoScalingInstances] -> ShowS
show :: DescribeAutoScalingInstances -> String
$cshow :: DescribeAutoScalingInstances -> String
showsPrec :: Int -> DescribeAutoScalingInstances -> ShowS
$cshowsPrec :: Int -> DescribeAutoScalingInstances -> ShowS
Prelude.Show, (forall x.
 DescribeAutoScalingInstances -> Rep DescribeAutoScalingInstances x)
-> (forall x.
    Rep DescribeAutoScalingInstances x -> DescribeAutoScalingInstances)
-> Generic DescribeAutoScalingInstances
forall x.
Rep DescribeAutoScalingInstances x -> DescribeAutoScalingInstances
forall x.
DescribeAutoScalingInstances -> Rep DescribeAutoScalingInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAutoScalingInstances x -> DescribeAutoScalingInstances
$cfrom :: forall x.
DescribeAutoScalingInstances -> Rep DescribeAutoScalingInstances x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAutoScalingInstances' 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', 'describeAutoScalingInstances_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'instanceIds', 'describeAutoScalingInstances_instanceIds' - The IDs of the instances. If you omit this parameter, all Auto Scaling
-- instances are described. If you specify an ID that does not exist, it is
-- ignored with no error.
--
-- Array Members: Maximum number of 50 items.
--
-- 'maxRecords', 'describeAutoScalingInstances_maxRecords' - The maximum number of items to return with this call. The default value
-- is @50@ and the maximum value is @50@.
newDescribeAutoScalingInstances ::
  DescribeAutoScalingInstances
newDescribeAutoScalingInstances :: DescribeAutoScalingInstances
newDescribeAutoScalingInstances =
  DescribeAutoScalingInstances' :: Maybe Text
-> Maybe [Text] -> Maybe Int -> DescribeAutoScalingInstances
DescribeAutoScalingInstances'
    { $sel:nextToken:DescribeAutoScalingInstances' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceIds:DescribeAutoScalingInstances' :: Maybe [Text]
instanceIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeAutoScalingInstances' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
describeAutoScalingInstances_nextToken :: Lens.Lens' DescribeAutoScalingInstances (Prelude.Maybe Prelude.Text)
describeAutoScalingInstances_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAutoScalingInstances -> f DescribeAutoScalingInstances
describeAutoScalingInstances_nextToken = (DescribeAutoScalingInstances -> Maybe Text)
-> (DescribeAutoScalingInstances
    -> Maybe Text -> DescribeAutoScalingInstances)
-> Lens
     DescribeAutoScalingInstances
     DescribeAutoScalingInstances
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutoScalingInstances' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAutoScalingInstances' :: DescribeAutoScalingInstances -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAutoScalingInstances
s@DescribeAutoScalingInstances' {} Maybe Text
a -> DescribeAutoScalingInstances
s {$sel:nextToken:DescribeAutoScalingInstances' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAutoScalingInstances)

-- | The IDs of the instances. If you omit this parameter, all Auto Scaling
-- instances are described. If you specify an ID that does not exist, it is
-- ignored with no error.
--
-- Array Members: Maximum number of 50 items.
describeAutoScalingInstances_instanceIds :: Lens.Lens' DescribeAutoScalingInstances (Prelude.Maybe [Prelude.Text])
describeAutoScalingInstances_instanceIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeAutoScalingInstances -> f DescribeAutoScalingInstances
describeAutoScalingInstances_instanceIds = (DescribeAutoScalingInstances -> Maybe [Text])
-> (DescribeAutoScalingInstances
    -> Maybe [Text] -> DescribeAutoScalingInstances)
-> Lens
     DescribeAutoScalingInstances
     DescribeAutoScalingInstances
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutoScalingInstances' {Maybe [Text]
instanceIds :: Maybe [Text]
$sel:instanceIds:DescribeAutoScalingInstances' :: DescribeAutoScalingInstances -> Maybe [Text]
instanceIds} -> Maybe [Text]
instanceIds) (\s :: DescribeAutoScalingInstances
s@DescribeAutoScalingInstances' {} Maybe [Text]
a -> DescribeAutoScalingInstances
s {$sel:instanceIds:DescribeAutoScalingInstances' :: Maybe [Text]
instanceIds = Maybe [Text]
a} :: DescribeAutoScalingInstances) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeAutoScalingInstances -> f DescribeAutoScalingInstances)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeAutoScalingInstances
-> f DescribeAutoScalingInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of items to return with this call. The default value
-- is @50@ and the maximum value is @50@.
describeAutoScalingInstances_maxRecords :: Lens.Lens' DescribeAutoScalingInstances (Prelude.Maybe Prelude.Int)
describeAutoScalingInstances_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeAutoScalingInstances -> f DescribeAutoScalingInstances
describeAutoScalingInstances_maxRecords = (DescribeAutoScalingInstances -> Maybe Int)
-> (DescribeAutoScalingInstances
    -> Maybe Int -> DescribeAutoScalingInstances)
-> Lens
     DescribeAutoScalingInstances
     DescribeAutoScalingInstances
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutoScalingInstances' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeAutoScalingInstances' :: DescribeAutoScalingInstances -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeAutoScalingInstances
s@DescribeAutoScalingInstances' {} Maybe Int
a -> DescribeAutoScalingInstances
s {$sel:maxRecords:DescribeAutoScalingInstances' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeAutoScalingInstances)

instance Core.AWSPager DescribeAutoScalingInstances where
  page :: DescribeAutoScalingInstances
-> AWSResponse DescribeAutoScalingInstances
-> Maybe DescribeAutoScalingInstances
page DescribeAutoScalingInstances
rq AWSResponse DescribeAutoScalingInstances
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAutoScalingInstances
DescribeAutoScalingInstancesResponse
rs
            DescribeAutoScalingInstancesResponse
-> Getting (First Text) DescribeAutoScalingInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeAutoScalingInstancesResponse
-> Const (First Text) DescribeAutoScalingInstancesResponse
Lens' DescribeAutoScalingInstancesResponse (Maybe Text)
describeAutoScalingInstancesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeAutoScalingInstancesResponse
 -> Const (First Text) DescribeAutoScalingInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeAutoScalingInstancesResponse 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 DescribeAutoScalingInstances
forall a. Maybe a
Prelude.Nothing
    | Maybe [AutoScalingInstanceDetails] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAutoScalingInstances
DescribeAutoScalingInstancesResponse
rs
            DescribeAutoScalingInstancesResponse
-> Getting
     (First [AutoScalingInstanceDetails])
     DescribeAutoScalingInstancesResponse
     [AutoScalingInstanceDetails]
-> Maybe [AutoScalingInstanceDetails]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [AutoScalingInstanceDetails]
 -> Const
      (First [AutoScalingInstanceDetails])
      (Maybe [AutoScalingInstanceDetails]))
-> DescribeAutoScalingInstancesResponse
-> Const
     (First [AutoScalingInstanceDetails])
     DescribeAutoScalingInstancesResponse
Lens'
  DescribeAutoScalingInstancesResponse
  (Maybe [AutoScalingInstanceDetails])
describeAutoScalingInstancesResponse_autoScalingInstances
              ((Maybe [AutoScalingInstanceDetails]
  -> Const
       (First [AutoScalingInstanceDetails])
       (Maybe [AutoScalingInstanceDetails]))
 -> DescribeAutoScalingInstancesResponse
 -> Const
      (First [AutoScalingInstanceDetails])
      DescribeAutoScalingInstancesResponse)
-> (([AutoScalingInstanceDetails]
     -> Const
          (First [AutoScalingInstanceDetails]) [AutoScalingInstanceDetails])
    -> Maybe [AutoScalingInstanceDetails]
    -> Const
         (First [AutoScalingInstanceDetails])
         (Maybe [AutoScalingInstanceDetails]))
-> Getting
     (First [AutoScalingInstanceDetails])
     DescribeAutoScalingInstancesResponse
     [AutoScalingInstanceDetails]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AutoScalingInstanceDetails]
 -> Const
      (First [AutoScalingInstanceDetails]) [AutoScalingInstanceDetails])
-> Maybe [AutoScalingInstanceDetails]
-> Const
     (First [AutoScalingInstanceDetails])
     (Maybe [AutoScalingInstanceDetails])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeAutoScalingInstances
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeAutoScalingInstances -> Maybe DescribeAutoScalingInstances
forall a. a -> Maybe a
Prelude.Just (DescribeAutoScalingInstances
 -> Maybe DescribeAutoScalingInstances)
-> DescribeAutoScalingInstances
-> Maybe DescribeAutoScalingInstances
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeAutoScalingInstances
rq
          DescribeAutoScalingInstances
-> (DescribeAutoScalingInstances -> DescribeAutoScalingInstances)
-> DescribeAutoScalingInstances
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeAutoScalingInstances
-> Identity DescribeAutoScalingInstances
Lens
  DescribeAutoScalingInstances
  DescribeAutoScalingInstances
  (Maybe Text)
  (Maybe Text)
describeAutoScalingInstances_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeAutoScalingInstances
 -> Identity DescribeAutoScalingInstances)
-> Maybe Text
-> DescribeAutoScalingInstances
-> DescribeAutoScalingInstances
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeAutoScalingInstances
DescribeAutoScalingInstancesResponse
rs
          DescribeAutoScalingInstancesResponse
-> Getting (First Text) DescribeAutoScalingInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeAutoScalingInstancesResponse
-> Const (First Text) DescribeAutoScalingInstancesResponse
Lens' DescribeAutoScalingInstancesResponse (Maybe Text)
describeAutoScalingInstancesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeAutoScalingInstancesResponse
 -> Const (First Text) DescribeAutoScalingInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeAutoScalingInstancesResponse 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 DescribeAutoScalingInstances where
  type
    AWSResponse DescribeAutoScalingInstances =
      DescribeAutoScalingInstancesResponse
  request :: DescribeAutoScalingInstances
-> Request DescribeAutoScalingInstances
request = Service
-> DescribeAutoScalingInstances
-> Request DescribeAutoScalingInstances
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAutoScalingInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAutoScalingInstances)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeAutoScalingInstances))
-> Logger
-> Service
-> Proxy DescribeAutoScalingInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAutoScalingInstances)))
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
"DescribeAutoScalingInstancesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [AutoScalingInstanceDetails]
-> Int
-> DescribeAutoScalingInstancesResponse
DescribeAutoScalingInstancesResponse'
            (Maybe Text
 -> Maybe [AutoScalingInstanceDetails]
 -> Int
 -> DescribeAutoScalingInstancesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [AutoScalingInstanceDetails]
      -> Int -> DescribeAutoScalingInstancesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
            Either
  String
  (Maybe [AutoScalingInstanceDetails]
   -> Int -> DescribeAutoScalingInstancesResponse)
-> Either String (Maybe [AutoScalingInstanceDetails])
-> Either String (Int -> DescribeAutoScalingInstancesResponse)
forall (f :: * -> *) a b. Applicative f => 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
"AutoScalingInstances"
                            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 [AutoScalingInstanceDetails]))
-> Either String (Maybe [AutoScalingInstanceDetails])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AutoScalingInstanceDetails])
-> [Node] -> Either String (Maybe [AutoScalingInstanceDetails])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AutoScalingInstanceDetails]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> DescribeAutoScalingInstancesResponse)
-> Either String Int
-> Either String DescribeAutoScalingInstancesResponse
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
    DescribeAutoScalingInstances

instance Prelude.NFData DescribeAutoScalingInstances

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

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

instance Core.ToQuery DescribeAutoScalingInstances where
  toQuery :: DescribeAutoScalingInstances -> QueryString
toQuery DescribeAutoScalingInstances' {Maybe Int
Maybe [Text]
Maybe Text
maxRecords :: Maybe Int
instanceIds :: Maybe [Text]
nextToken :: Maybe Text
$sel:maxRecords:DescribeAutoScalingInstances' :: DescribeAutoScalingInstances -> Maybe Int
$sel:instanceIds:DescribeAutoScalingInstances' :: DescribeAutoScalingInstances -> Maybe [Text]
$sel:nextToken:DescribeAutoScalingInstances' :: DescribeAutoScalingInstances -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"DescribeAutoScalingInstances" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"InstanceIds"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
instanceIds),
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords
      ]

-- | /See:/ 'newDescribeAutoScalingInstancesResponse' smart constructor.
data DescribeAutoScalingInstancesResponse = DescribeAutoScalingInstancesResponse'
  { -- | A string that indicates that the response contains more items than can
    -- be returned in a single response. To receive additional items, specify
    -- this string for the @NextToken@ value when requesting the next set of
    -- items. This value is null when there are no more items to return.
    DescribeAutoScalingInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The instances.
    DescribeAutoScalingInstancesResponse
-> Maybe [AutoScalingInstanceDetails]
autoScalingInstances :: Prelude.Maybe [AutoScalingInstanceDetails],
    -- | The response's http status code.
    DescribeAutoScalingInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAutoScalingInstancesResponse
-> DescribeAutoScalingInstancesResponse -> Bool
(DescribeAutoScalingInstancesResponse
 -> DescribeAutoScalingInstancesResponse -> Bool)
-> (DescribeAutoScalingInstancesResponse
    -> DescribeAutoScalingInstancesResponse -> Bool)
-> Eq DescribeAutoScalingInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAutoScalingInstancesResponse
-> DescribeAutoScalingInstancesResponse -> Bool
$c/= :: DescribeAutoScalingInstancesResponse
-> DescribeAutoScalingInstancesResponse -> Bool
== :: DescribeAutoScalingInstancesResponse
-> DescribeAutoScalingInstancesResponse -> Bool
$c== :: DescribeAutoScalingInstancesResponse
-> DescribeAutoScalingInstancesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAutoScalingInstancesResponse]
ReadPrec DescribeAutoScalingInstancesResponse
Int -> ReadS DescribeAutoScalingInstancesResponse
ReadS [DescribeAutoScalingInstancesResponse]
(Int -> ReadS DescribeAutoScalingInstancesResponse)
-> ReadS [DescribeAutoScalingInstancesResponse]
-> ReadPrec DescribeAutoScalingInstancesResponse
-> ReadPrec [DescribeAutoScalingInstancesResponse]
-> Read DescribeAutoScalingInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAutoScalingInstancesResponse]
$creadListPrec :: ReadPrec [DescribeAutoScalingInstancesResponse]
readPrec :: ReadPrec DescribeAutoScalingInstancesResponse
$creadPrec :: ReadPrec DescribeAutoScalingInstancesResponse
readList :: ReadS [DescribeAutoScalingInstancesResponse]
$creadList :: ReadS [DescribeAutoScalingInstancesResponse]
readsPrec :: Int -> ReadS DescribeAutoScalingInstancesResponse
$creadsPrec :: Int -> ReadS DescribeAutoScalingInstancesResponse
Prelude.Read, Int -> DescribeAutoScalingInstancesResponse -> ShowS
[DescribeAutoScalingInstancesResponse] -> ShowS
DescribeAutoScalingInstancesResponse -> String
(Int -> DescribeAutoScalingInstancesResponse -> ShowS)
-> (DescribeAutoScalingInstancesResponse -> String)
-> ([DescribeAutoScalingInstancesResponse] -> ShowS)
-> Show DescribeAutoScalingInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAutoScalingInstancesResponse] -> ShowS
$cshowList :: [DescribeAutoScalingInstancesResponse] -> ShowS
show :: DescribeAutoScalingInstancesResponse -> String
$cshow :: DescribeAutoScalingInstancesResponse -> String
showsPrec :: Int -> DescribeAutoScalingInstancesResponse -> ShowS
$cshowsPrec :: Int -> DescribeAutoScalingInstancesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAutoScalingInstancesResponse
 -> Rep DescribeAutoScalingInstancesResponse x)
-> (forall x.
    Rep DescribeAutoScalingInstancesResponse x
    -> DescribeAutoScalingInstancesResponse)
-> Generic DescribeAutoScalingInstancesResponse
forall x.
Rep DescribeAutoScalingInstancesResponse x
-> DescribeAutoScalingInstancesResponse
forall x.
DescribeAutoScalingInstancesResponse
-> Rep DescribeAutoScalingInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAutoScalingInstancesResponse x
-> DescribeAutoScalingInstancesResponse
$cfrom :: forall x.
DescribeAutoScalingInstancesResponse
-> Rep DescribeAutoScalingInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAutoScalingInstancesResponse' 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', 'describeAutoScalingInstancesResponse_nextToken' - A string that indicates that the response contains more items than can
-- be returned in a single response. To receive additional items, specify
-- this string for the @NextToken@ value when requesting the next set of
-- items. This value is null when there are no more items to return.
--
-- 'autoScalingInstances', 'describeAutoScalingInstancesResponse_autoScalingInstances' - The instances.
--
-- 'httpStatus', 'describeAutoScalingInstancesResponse_httpStatus' - The response's http status code.
newDescribeAutoScalingInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAutoScalingInstancesResponse
newDescribeAutoScalingInstancesResponse :: Int -> DescribeAutoScalingInstancesResponse
newDescribeAutoScalingInstancesResponse Int
pHttpStatus_ =
  DescribeAutoScalingInstancesResponse' :: Maybe Text
-> Maybe [AutoScalingInstanceDetails]
-> Int
-> DescribeAutoScalingInstancesResponse
DescribeAutoScalingInstancesResponse'
    { $sel:nextToken:DescribeAutoScalingInstancesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingInstances:DescribeAutoScalingInstancesResponse' :: Maybe [AutoScalingInstanceDetails]
autoScalingInstances =
        Maybe [AutoScalingInstanceDetails]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAutoScalingInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A string that indicates that the response contains more items than can
-- be returned in a single response. To receive additional items, specify
-- this string for the @NextToken@ value when requesting the next set of
-- items. This value is null when there are no more items to return.
describeAutoScalingInstancesResponse_nextToken :: Lens.Lens' DescribeAutoScalingInstancesResponse (Prelude.Maybe Prelude.Text)
describeAutoScalingInstancesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAutoScalingInstancesResponse
-> f DescribeAutoScalingInstancesResponse
describeAutoScalingInstancesResponse_nextToken = (DescribeAutoScalingInstancesResponse -> Maybe Text)
-> (DescribeAutoScalingInstancesResponse
    -> Maybe Text -> DescribeAutoScalingInstancesResponse)
-> Lens' DescribeAutoScalingInstancesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutoScalingInstancesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAutoScalingInstancesResponse' :: DescribeAutoScalingInstancesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAutoScalingInstancesResponse
s@DescribeAutoScalingInstancesResponse' {} Maybe Text
a -> DescribeAutoScalingInstancesResponse
s {$sel:nextToken:DescribeAutoScalingInstancesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAutoScalingInstancesResponse)

-- | The instances.
describeAutoScalingInstancesResponse_autoScalingInstances :: Lens.Lens' DescribeAutoScalingInstancesResponse (Prelude.Maybe [AutoScalingInstanceDetails])
describeAutoScalingInstancesResponse_autoScalingInstances :: (Maybe [AutoScalingInstanceDetails]
 -> f (Maybe [AutoScalingInstanceDetails]))
-> DescribeAutoScalingInstancesResponse
-> f DescribeAutoScalingInstancesResponse
describeAutoScalingInstancesResponse_autoScalingInstances = (DescribeAutoScalingInstancesResponse
 -> Maybe [AutoScalingInstanceDetails])
-> (DescribeAutoScalingInstancesResponse
    -> Maybe [AutoScalingInstanceDetails]
    -> DescribeAutoScalingInstancesResponse)
-> Lens'
     DescribeAutoScalingInstancesResponse
     (Maybe [AutoScalingInstanceDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutoScalingInstancesResponse' {Maybe [AutoScalingInstanceDetails]
autoScalingInstances :: Maybe [AutoScalingInstanceDetails]
$sel:autoScalingInstances:DescribeAutoScalingInstancesResponse' :: DescribeAutoScalingInstancesResponse
-> Maybe [AutoScalingInstanceDetails]
autoScalingInstances} -> Maybe [AutoScalingInstanceDetails]
autoScalingInstances) (\s :: DescribeAutoScalingInstancesResponse
s@DescribeAutoScalingInstancesResponse' {} Maybe [AutoScalingInstanceDetails]
a -> DescribeAutoScalingInstancesResponse
s {$sel:autoScalingInstances:DescribeAutoScalingInstancesResponse' :: Maybe [AutoScalingInstanceDetails]
autoScalingInstances = Maybe [AutoScalingInstanceDetails]
a} :: DescribeAutoScalingInstancesResponse) ((Maybe [AutoScalingInstanceDetails]
  -> f (Maybe [AutoScalingInstanceDetails]))
 -> DescribeAutoScalingInstancesResponse
 -> f DescribeAutoScalingInstancesResponse)
-> ((Maybe [AutoScalingInstanceDetails]
     -> f (Maybe [AutoScalingInstanceDetails]))
    -> Maybe [AutoScalingInstanceDetails]
    -> f (Maybe [AutoScalingInstanceDetails]))
-> (Maybe [AutoScalingInstanceDetails]
    -> f (Maybe [AutoScalingInstanceDetails]))
-> DescribeAutoScalingInstancesResponse
-> f DescribeAutoScalingInstancesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AutoScalingInstanceDetails]
  [AutoScalingInstanceDetails]
  [AutoScalingInstanceDetails]
  [AutoScalingInstanceDetails]
-> Iso
     (Maybe [AutoScalingInstanceDetails])
     (Maybe [AutoScalingInstanceDetails])
     (Maybe [AutoScalingInstanceDetails])
     (Maybe [AutoScalingInstanceDetails])
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
  [AutoScalingInstanceDetails]
  [AutoScalingInstanceDetails]
  [AutoScalingInstanceDetails]
  [AutoScalingInstanceDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAutoScalingInstancesResponse