{-# 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.DocumentDB.DescribeDBInstances
-- 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)
--
-- Returns information about provisioned Amazon DocumentDB instances. This
-- API supports pagination.
--
-- This operation returns paginated results.
module Amazonka.DocumentDB.DescribeDBInstances
  ( -- * Creating a Request
    DescribeDBInstances (..),
    newDescribeDBInstances,

    -- * Request Lenses
    describeDBInstances_filters,
    describeDBInstances_dbInstanceIdentifier,
    describeDBInstances_marker,
    describeDBInstances_maxRecords,

    -- * Destructuring the Response
    DescribeDBInstancesResponse (..),
    newDescribeDBInstancesResponse,

    -- * Response Lenses
    describeDBInstancesResponse_dbInstances,
    describeDBInstancesResponse_marker,
    describeDBInstancesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DocumentDB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input to DescribeDBInstances.
--
-- /See:/ 'newDescribeDBInstances' smart constructor.
data DescribeDBInstances = DescribeDBInstances'
  { -- | A filter that specifies one or more instances to describe.
    --
    -- Supported filters:
    --
    -- -   @db-cluster-id@ - Accepts cluster identifiers and cluster Amazon
    --     Resource Names (ARNs). The results list includes only the
    --     information about the instances that are associated with the
    --     clusters that are identified by these ARNs.
    --
    -- -   @db-instance-id@ - Accepts instance identifiers and instance ARNs.
    --     The results list includes only the information about the instances
    --     that are identified by these ARNs.
    DescribeDBInstances -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The user-provided instance identifier. If this parameter is specified,
    -- information from only the specific instance is returned. This parameter
    -- isn\'t case sensitive.
    --
    -- Constraints:
    --
    -- -   If provided, must match the identifier of an existing @DBInstance@.
    DescribeDBInstances -> Maybe Text
dbInstanceIdentifier :: Prelude.Maybe Prelude.Text,
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeDBInstances -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified @MaxRecords@ value, a pagination token
    -- (marker) is included in the response so that the remaining results can
    -- be retrieved.
    --
    -- Default: 100
    --
    -- Constraints: Minimum 20, maximum 100.
    DescribeDBInstances -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeDBInstances -> DescribeDBInstances -> Bool
(DescribeDBInstances -> DescribeDBInstances -> Bool)
-> (DescribeDBInstances -> DescribeDBInstances -> Bool)
-> Eq DescribeDBInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBInstances -> DescribeDBInstances -> Bool
$c/= :: DescribeDBInstances -> DescribeDBInstances -> Bool
== :: DescribeDBInstances -> DescribeDBInstances -> Bool
$c== :: DescribeDBInstances -> DescribeDBInstances -> Bool
Prelude.Eq, ReadPrec [DescribeDBInstances]
ReadPrec DescribeDBInstances
Int -> ReadS DescribeDBInstances
ReadS [DescribeDBInstances]
(Int -> ReadS DescribeDBInstances)
-> ReadS [DescribeDBInstances]
-> ReadPrec DescribeDBInstances
-> ReadPrec [DescribeDBInstances]
-> Read DescribeDBInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBInstances]
$creadListPrec :: ReadPrec [DescribeDBInstances]
readPrec :: ReadPrec DescribeDBInstances
$creadPrec :: ReadPrec DescribeDBInstances
readList :: ReadS [DescribeDBInstances]
$creadList :: ReadS [DescribeDBInstances]
readsPrec :: Int -> ReadS DescribeDBInstances
$creadsPrec :: Int -> ReadS DescribeDBInstances
Prelude.Read, Int -> DescribeDBInstances -> ShowS
[DescribeDBInstances] -> ShowS
DescribeDBInstances -> String
(Int -> DescribeDBInstances -> ShowS)
-> (DescribeDBInstances -> String)
-> ([DescribeDBInstances] -> ShowS)
-> Show DescribeDBInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBInstances] -> ShowS
$cshowList :: [DescribeDBInstances] -> ShowS
show :: DescribeDBInstances -> String
$cshow :: DescribeDBInstances -> String
showsPrec :: Int -> DescribeDBInstances -> ShowS
$cshowsPrec :: Int -> DescribeDBInstances -> ShowS
Prelude.Show, (forall x. DescribeDBInstances -> Rep DescribeDBInstances x)
-> (forall x. Rep DescribeDBInstances x -> DescribeDBInstances)
-> Generic DescribeDBInstances
forall x. Rep DescribeDBInstances x -> DescribeDBInstances
forall x. DescribeDBInstances -> Rep DescribeDBInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDBInstances x -> DescribeDBInstances
$cfrom :: forall x. DescribeDBInstances -> Rep DescribeDBInstances x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBInstances' 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:
--
-- 'filters', 'describeDBInstances_filters' - A filter that specifies one or more instances to describe.
--
-- Supported filters:
--
-- -   @db-cluster-id@ - Accepts cluster identifiers and cluster Amazon
--     Resource Names (ARNs). The results list includes only the
--     information about the instances that are associated with the
--     clusters that are identified by these ARNs.
--
-- -   @db-instance-id@ - Accepts instance identifiers and instance ARNs.
--     The results list includes only the information about the instances
--     that are identified by these ARNs.
--
-- 'dbInstanceIdentifier', 'describeDBInstances_dbInstanceIdentifier' - The user-provided instance identifier. If this parameter is specified,
-- information from only the specific instance is returned. This parameter
-- isn\'t case sensitive.
--
-- Constraints:
--
-- -   If provided, must match the identifier of an existing @DBInstance@.
--
-- 'marker', 'describeDBInstances_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'maxRecords', 'describeDBInstances_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- (marker) is included in the response so that the remaining results can
-- be retrieved.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
newDescribeDBInstances ::
  DescribeDBInstances
newDescribeDBInstances :: DescribeDBInstances
newDescribeDBInstances =
  DescribeDBInstances' :: Maybe [Filter]
-> Maybe Text -> Maybe Text -> Maybe Int -> DescribeDBInstances
DescribeDBInstances'
    { $sel:filters:DescribeDBInstances' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:dbInstanceIdentifier:DescribeDBInstances' :: Maybe Text
dbInstanceIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBInstances' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeDBInstances' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that specifies one or more instances to describe.
--
-- Supported filters:
--
-- -   @db-cluster-id@ - Accepts cluster identifiers and cluster Amazon
--     Resource Names (ARNs). The results list includes only the
--     information about the instances that are associated with the
--     clusters that are identified by these ARNs.
--
-- -   @db-instance-id@ - Accepts instance identifiers and instance ARNs.
--     The results list includes only the information about the instances
--     that are identified by these ARNs.
describeDBInstances_filters :: Lens.Lens' DescribeDBInstances (Prelude.Maybe [Filter])
describeDBInstances_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBInstances -> f DescribeDBInstances
describeDBInstances_filters = (DescribeDBInstances -> Maybe [Filter])
-> (DescribeDBInstances -> Maybe [Filter] -> DescribeDBInstances)
-> Lens
     DescribeDBInstances
     DescribeDBInstances
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBInstances' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeDBInstances' :: DescribeDBInstances -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeDBInstances
s@DescribeDBInstances' {} Maybe [Filter]
a -> DescribeDBInstances
s {$sel:filters:DescribeDBInstances' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeDBInstances) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeDBInstances -> f DescribeDBInstances)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBInstances
-> f DescribeDBInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The user-provided instance identifier. If this parameter is specified,
-- information from only the specific instance is returned. This parameter
-- isn\'t case sensitive.
--
-- Constraints:
--
-- -   If provided, must match the identifier of an existing @DBInstance@.
describeDBInstances_dbInstanceIdentifier :: Lens.Lens' DescribeDBInstances (Prelude.Maybe Prelude.Text)
describeDBInstances_dbInstanceIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeDBInstances -> f DescribeDBInstances
describeDBInstances_dbInstanceIdentifier = (DescribeDBInstances -> Maybe Text)
-> (DescribeDBInstances -> Maybe Text -> DescribeDBInstances)
-> Lens
     DescribeDBInstances DescribeDBInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBInstances' {Maybe Text
dbInstanceIdentifier :: Maybe Text
$sel:dbInstanceIdentifier:DescribeDBInstances' :: DescribeDBInstances -> Maybe Text
dbInstanceIdentifier} -> Maybe Text
dbInstanceIdentifier) (\s :: DescribeDBInstances
s@DescribeDBInstances' {} Maybe Text
a -> DescribeDBInstances
s {$sel:dbInstanceIdentifier:DescribeDBInstances' :: Maybe Text
dbInstanceIdentifier = Maybe Text
a} :: DescribeDBInstances)

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
describeDBInstances_marker :: Lens.Lens' DescribeDBInstances (Prelude.Maybe Prelude.Text)
describeDBInstances_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDBInstances -> f DescribeDBInstances
describeDBInstances_marker = (DescribeDBInstances -> Maybe Text)
-> (DescribeDBInstances -> Maybe Text -> DescribeDBInstances)
-> Lens
     DescribeDBInstances DescribeDBInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBInstances' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDBInstances' :: DescribeDBInstances -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDBInstances
s@DescribeDBInstances' {} Maybe Text
a -> DescribeDBInstances
s {$sel:marker:DescribeDBInstances' :: Maybe Text
marker = Maybe Text
a} :: DescribeDBInstances)

-- | The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- (marker) is included in the response so that the remaining results can
-- be retrieved.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
describeDBInstances_maxRecords :: Lens.Lens' DescribeDBInstances (Prelude.Maybe Prelude.Int)
describeDBInstances_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeDBInstances -> f DescribeDBInstances
describeDBInstances_maxRecords = (DescribeDBInstances -> Maybe Int)
-> (DescribeDBInstances -> Maybe Int -> DescribeDBInstances)
-> Lens
     DescribeDBInstances DescribeDBInstances (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBInstances' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeDBInstances' :: DescribeDBInstances -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeDBInstances
s@DescribeDBInstances' {} Maybe Int
a -> DescribeDBInstances
s {$sel:maxRecords:DescribeDBInstances' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeDBInstances)

instance Core.AWSPager DescribeDBInstances where
  page :: DescribeDBInstances
-> AWSResponse DescribeDBInstances -> Maybe DescribeDBInstances
page DescribeDBInstances
rq AWSResponse DescribeDBInstances
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDBInstances
DescribeDBInstancesResponse
rs
            DescribeDBInstancesResponse
-> Getting (First Text) DescribeDBInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDBInstancesResponse
-> Const (First Text) DescribeDBInstancesResponse
Lens' DescribeDBInstancesResponse (Maybe Text)
describeDBInstancesResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDBInstancesResponse
 -> Const (First Text) DescribeDBInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeDBInstancesResponse 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 DescribeDBInstances
forall a. Maybe a
Prelude.Nothing
    | Maybe [DBInstance] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDBInstances
DescribeDBInstancesResponse
rs
            DescribeDBInstancesResponse
-> Getting
     (First [DBInstance]) DescribeDBInstancesResponse [DBInstance]
-> Maybe [DBInstance]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DBInstance]
 -> Const (First [DBInstance]) (Maybe [DBInstance]))
-> DescribeDBInstancesResponse
-> Const (First [DBInstance]) DescribeDBInstancesResponse
Lens' DescribeDBInstancesResponse (Maybe [DBInstance])
describeDBInstancesResponse_dbInstances
              ((Maybe [DBInstance]
  -> Const (First [DBInstance]) (Maybe [DBInstance]))
 -> DescribeDBInstancesResponse
 -> Const (First [DBInstance]) DescribeDBInstancesResponse)
-> (([DBInstance] -> Const (First [DBInstance]) [DBInstance])
    -> Maybe [DBInstance]
    -> Const (First [DBInstance]) (Maybe [DBInstance]))
-> Getting
     (First [DBInstance]) DescribeDBInstancesResponse [DBInstance]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DBInstance] -> Const (First [DBInstance]) [DBInstance])
-> Maybe [DBInstance]
-> Const (First [DBInstance]) (Maybe [DBInstance])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeDBInstances
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeDBInstances -> Maybe DescribeDBInstances
forall a. a -> Maybe a
Prelude.Just (DescribeDBInstances -> Maybe DescribeDBInstances)
-> DescribeDBInstances -> Maybe DescribeDBInstances
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeDBInstances
rq
          DescribeDBInstances
-> (DescribeDBInstances -> DescribeDBInstances)
-> DescribeDBInstances
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeDBInstances -> Identity DescribeDBInstances
Lens
  DescribeDBInstances DescribeDBInstances (Maybe Text) (Maybe Text)
describeDBInstances_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeDBInstances -> Identity DescribeDBInstances)
-> Maybe Text -> DescribeDBInstances -> DescribeDBInstances
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeDBInstances
DescribeDBInstancesResponse
rs
          DescribeDBInstancesResponse
-> Getting (First Text) DescribeDBInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDBInstancesResponse
-> Const (First Text) DescribeDBInstancesResponse
Lens' DescribeDBInstancesResponse (Maybe Text)
describeDBInstancesResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDBInstancesResponse
 -> Const (First Text) DescribeDBInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeDBInstancesResponse 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 DescribeDBInstances where
  type
    AWSResponse DescribeDBInstances =
      DescribeDBInstancesResponse
  request :: DescribeDBInstances -> Request DescribeDBInstances
request = Service -> DescribeDBInstances -> Request DescribeDBInstances
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDBInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDBInstances)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeDBInstances))
-> Logger
-> Service
-> Proxy DescribeDBInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDBInstances)))
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
"DescribeDBInstancesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [DBInstance]
-> Maybe Text -> Int -> DescribeDBInstancesResponse
DescribeDBInstancesResponse'
            (Maybe [DBInstance]
 -> Maybe Text -> Int -> DescribeDBInstancesResponse)
-> Either String (Maybe [DBInstance])
-> Either String (Maybe Text -> Int -> DescribeDBInstancesResponse)
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
"DBInstances" 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 [DBInstance]))
-> Either String (Maybe [DBInstance])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [DBInstance])
-> [Node] -> Either String (Maybe [DBInstance])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [DBInstance]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"DBInstance")
                        )
            Either String (Maybe Text -> Int -> DescribeDBInstancesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeDBInstancesResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Marker")
            Either String (Int -> DescribeDBInstancesResponse)
-> Either String Int -> Either String DescribeDBInstancesResponse
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 DescribeDBInstances

instance Prelude.NFData DescribeDBInstances

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

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

instance Core.ToQuery DescribeDBInstances where
  toQuery :: DescribeDBInstances -> QueryString
toQuery DescribeDBInstances' {Maybe Int
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
dbInstanceIdentifier :: Maybe Text
filters :: Maybe [Filter]
$sel:maxRecords:DescribeDBInstances' :: DescribeDBInstances -> Maybe Int
$sel:marker:DescribeDBInstances' :: DescribeDBInstances -> Maybe Text
$sel:dbInstanceIdentifier:DescribeDBInstances' :: DescribeDBInstances -> Maybe Text
$sel:filters:DescribeDBInstances' :: DescribeDBInstances -> Maybe [Filter]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeDBInstances" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"Filters"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Filter] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Filter" ([Filter] -> QueryString) -> Maybe [Filter] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
        ByteString
"DBInstanceIdentifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
dbInstanceIdentifier,
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords
      ]

-- | Represents the output of DescribeDBInstances.
--
-- /See:/ 'newDescribeDBInstancesResponse' smart constructor.
data DescribeDBInstancesResponse = DescribeDBInstancesResponse'
  { -- | Detailed information about one or more instances.
    DescribeDBInstancesResponse -> Maybe [DBInstance]
dbInstances :: Prelude.Maybe [DBInstance],
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeDBInstancesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeDBInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDBInstancesResponse -> DescribeDBInstancesResponse -> Bool
(DescribeDBInstancesResponse
 -> DescribeDBInstancesResponse -> Bool)
-> (DescribeDBInstancesResponse
    -> DescribeDBInstancesResponse -> Bool)
-> Eq DescribeDBInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBInstancesResponse -> DescribeDBInstancesResponse -> Bool
$c/= :: DescribeDBInstancesResponse -> DescribeDBInstancesResponse -> Bool
== :: DescribeDBInstancesResponse -> DescribeDBInstancesResponse -> Bool
$c== :: DescribeDBInstancesResponse -> DescribeDBInstancesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDBInstancesResponse]
ReadPrec DescribeDBInstancesResponse
Int -> ReadS DescribeDBInstancesResponse
ReadS [DescribeDBInstancesResponse]
(Int -> ReadS DescribeDBInstancesResponse)
-> ReadS [DescribeDBInstancesResponse]
-> ReadPrec DescribeDBInstancesResponse
-> ReadPrec [DescribeDBInstancesResponse]
-> Read DescribeDBInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBInstancesResponse]
$creadListPrec :: ReadPrec [DescribeDBInstancesResponse]
readPrec :: ReadPrec DescribeDBInstancesResponse
$creadPrec :: ReadPrec DescribeDBInstancesResponse
readList :: ReadS [DescribeDBInstancesResponse]
$creadList :: ReadS [DescribeDBInstancesResponse]
readsPrec :: Int -> ReadS DescribeDBInstancesResponse
$creadsPrec :: Int -> ReadS DescribeDBInstancesResponse
Prelude.Read, Int -> DescribeDBInstancesResponse -> ShowS
[DescribeDBInstancesResponse] -> ShowS
DescribeDBInstancesResponse -> String
(Int -> DescribeDBInstancesResponse -> ShowS)
-> (DescribeDBInstancesResponse -> String)
-> ([DescribeDBInstancesResponse] -> ShowS)
-> Show DescribeDBInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBInstancesResponse] -> ShowS
$cshowList :: [DescribeDBInstancesResponse] -> ShowS
show :: DescribeDBInstancesResponse -> String
$cshow :: DescribeDBInstancesResponse -> String
showsPrec :: Int -> DescribeDBInstancesResponse -> ShowS
$cshowsPrec :: Int -> DescribeDBInstancesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDBInstancesResponse -> Rep DescribeDBInstancesResponse x)
-> (forall x.
    Rep DescribeDBInstancesResponse x -> DescribeDBInstancesResponse)
-> Generic DescribeDBInstancesResponse
forall x.
Rep DescribeDBInstancesResponse x -> DescribeDBInstancesResponse
forall x.
DescribeDBInstancesResponse -> Rep DescribeDBInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDBInstancesResponse x -> DescribeDBInstancesResponse
$cfrom :: forall x.
DescribeDBInstancesResponse -> Rep DescribeDBInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBInstancesResponse' 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:
--
-- 'dbInstances', 'describeDBInstancesResponse_dbInstances' - Detailed information about one or more instances.
--
-- 'marker', 'describeDBInstancesResponse_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'httpStatus', 'describeDBInstancesResponse_httpStatus' - The response's http status code.
newDescribeDBInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDBInstancesResponse
newDescribeDBInstancesResponse :: Int -> DescribeDBInstancesResponse
newDescribeDBInstancesResponse Int
pHttpStatus_ =
  DescribeDBInstancesResponse' :: Maybe [DBInstance]
-> Maybe Text -> Int -> DescribeDBInstancesResponse
DescribeDBInstancesResponse'
    { $sel:dbInstances:DescribeDBInstancesResponse' :: Maybe [DBInstance]
dbInstances =
        Maybe [DBInstance]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBInstancesResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDBInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Detailed information about one or more instances.
describeDBInstancesResponse_dbInstances :: Lens.Lens' DescribeDBInstancesResponse (Prelude.Maybe [DBInstance])
describeDBInstancesResponse_dbInstances :: (Maybe [DBInstance] -> f (Maybe [DBInstance]))
-> DescribeDBInstancesResponse -> f DescribeDBInstancesResponse
describeDBInstancesResponse_dbInstances = (DescribeDBInstancesResponse -> Maybe [DBInstance])
-> (DescribeDBInstancesResponse
    -> Maybe [DBInstance] -> DescribeDBInstancesResponse)
-> Lens' DescribeDBInstancesResponse (Maybe [DBInstance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBInstancesResponse' {Maybe [DBInstance]
dbInstances :: Maybe [DBInstance]
$sel:dbInstances:DescribeDBInstancesResponse' :: DescribeDBInstancesResponse -> Maybe [DBInstance]
dbInstances} -> Maybe [DBInstance]
dbInstances) (\s :: DescribeDBInstancesResponse
s@DescribeDBInstancesResponse' {} Maybe [DBInstance]
a -> DescribeDBInstancesResponse
s {$sel:dbInstances:DescribeDBInstancesResponse' :: Maybe [DBInstance]
dbInstances = Maybe [DBInstance]
a} :: DescribeDBInstancesResponse) ((Maybe [DBInstance] -> f (Maybe [DBInstance]))
 -> DescribeDBInstancesResponse -> f DescribeDBInstancesResponse)
-> ((Maybe [DBInstance] -> f (Maybe [DBInstance]))
    -> Maybe [DBInstance] -> f (Maybe [DBInstance]))
-> (Maybe [DBInstance] -> f (Maybe [DBInstance]))
-> DescribeDBInstancesResponse
-> f DescribeDBInstancesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DBInstance] [DBInstance] [DBInstance] [DBInstance]
-> Iso
     (Maybe [DBInstance])
     (Maybe [DBInstance])
     (Maybe [DBInstance])
     (Maybe [DBInstance])
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 [DBInstance] [DBInstance] [DBInstance] [DBInstance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
describeDBInstancesResponse_marker :: Lens.Lens' DescribeDBInstancesResponse (Prelude.Maybe Prelude.Text)
describeDBInstancesResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDBInstancesResponse -> f DescribeDBInstancesResponse
describeDBInstancesResponse_marker = (DescribeDBInstancesResponse -> Maybe Text)
-> (DescribeDBInstancesResponse
    -> Maybe Text -> DescribeDBInstancesResponse)
-> Lens' DescribeDBInstancesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBInstancesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDBInstancesResponse' :: DescribeDBInstancesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDBInstancesResponse
s@DescribeDBInstancesResponse' {} Maybe Text
a -> DescribeDBInstancesResponse
s {$sel:marker:DescribeDBInstancesResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeDBInstancesResponse)

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

instance Prelude.NFData DescribeDBInstancesResponse