{-# 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.RDS.DescribeDBSubnetGroups
-- 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 a list of DBSubnetGroup descriptions. If a DBSubnetGroupName is
-- specified, the list will contain only the descriptions of the specified
-- DBSubnetGroup.
--
-- For an overview of CIDR ranges, go to the
-- <http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing Wikipedia Tutorial>.
--
-- This operation returns paginated results.
module Amazonka.RDS.DescribeDBSubnetGroups
  ( -- * Creating a Request
    DescribeDBSubnetGroups (..),
    newDescribeDBSubnetGroups,

    -- * Request Lenses
    describeDBSubnetGroups_dbSubnetGroupName,
    describeDBSubnetGroups_filters,
    describeDBSubnetGroups_marker,
    describeDBSubnetGroups_maxRecords,

    -- * Destructuring the Response
    DescribeDBSubnetGroupsResponse (..),
    newDescribeDBSubnetGroupsResponse,

    -- * Response Lenses
    describeDBSubnetGroupsResponse_dbSubnetGroups,
    describeDBSubnetGroupsResponse_marker,
    describeDBSubnetGroupsResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newDescribeDBSubnetGroups' smart constructor.
data DescribeDBSubnetGroups = DescribeDBSubnetGroups'
  { -- | The name of the DB subnet group to return details for.
    DescribeDBSubnetGroups -> Maybe Text
dbSubnetGroupName :: Prelude.Maybe Prelude.Text,
    -- | This parameter isn\'t currently supported.
    DescribeDBSubnetGroups -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An optional pagination token provided by a previous
    -- DescribeDBSubnetGroups request. If this parameter is specified, the
    -- response includes only records beyond the marker, up to the value
    -- specified by @MaxRecords@.
    DescribeDBSubnetGroups -> 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
    -- called a marker is included in the response so that you can retrieve the
    -- remaining results.
    --
    -- Default: 100
    --
    -- Constraints: Minimum 20, maximum 100.
    DescribeDBSubnetGroups -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeDBSubnetGroups -> DescribeDBSubnetGroups -> Bool
(DescribeDBSubnetGroups -> DescribeDBSubnetGroups -> Bool)
-> (DescribeDBSubnetGroups -> DescribeDBSubnetGroups -> Bool)
-> Eq DescribeDBSubnetGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBSubnetGroups -> DescribeDBSubnetGroups -> Bool
$c/= :: DescribeDBSubnetGroups -> DescribeDBSubnetGroups -> Bool
== :: DescribeDBSubnetGroups -> DescribeDBSubnetGroups -> Bool
$c== :: DescribeDBSubnetGroups -> DescribeDBSubnetGroups -> Bool
Prelude.Eq, ReadPrec [DescribeDBSubnetGroups]
ReadPrec DescribeDBSubnetGroups
Int -> ReadS DescribeDBSubnetGroups
ReadS [DescribeDBSubnetGroups]
(Int -> ReadS DescribeDBSubnetGroups)
-> ReadS [DescribeDBSubnetGroups]
-> ReadPrec DescribeDBSubnetGroups
-> ReadPrec [DescribeDBSubnetGroups]
-> Read DescribeDBSubnetGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBSubnetGroups]
$creadListPrec :: ReadPrec [DescribeDBSubnetGroups]
readPrec :: ReadPrec DescribeDBSubnetGroups
$creadPrec :: ReadPrec DescribeDBSubnetGroups
readList :: ReadS [DescribeDBSubnetGroups]
$creadList :: ReadS [DescribeDBSubnetGroups]
readsPrec :: Int -> ReadS DescribeDBSubnetGroups
$creadsPrec :: Int -> ReadS DescribeDBSubnetGroups
Prelude.Read, Int -> DescribeDBSubnetGroups -> ShowS
[DescribeDBSubnetGroups] -> ShowS
DescribeDBSubnetGroups -> String
(Int -> DescribeDBSubnetGroups -> ShowS)
-> (DescribeDBSubnetGroups -> String)
-> ([DescribeDBSubnetGroups] -> ShowS)
-> Show DescribeDBSubnetGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBSubnetGroups] -> ShowS
$cshowList :: [DescribeDBSubnetGroups] -> ShowS
show :: DescribeDBSubnetGroups -> String
$cshow :: DescribeDBSubnetGroups -> String
showsPrec :: Int -> DescribeDBSubnetGroups -> ShowS
$cshowsPrec :: Int -> DescribeDBSubnetGroups -> ShowS
Prelude.Show, (forall x. DescribeDBSubnetGroups -> Rep DescribeDBSubnetGroups x)
-> (forall x.
    Rep DescribeDBSubnetGroups x -> DescribeDBSubnetGroups)
-> Generic DescribeDBSubnetGroups
forall x. Rep DescribeDBSubnetGroups x -> DescribeDBSubnetGroups
forall x. DescribeDBSubnetGroups -> Rep DescribeDBSubnetGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDBSubnetGroups x -> DescribeDBSubnetGroups
$cfrom :: forall x. DescribeDBSubnetGroups -> Rep DescribeDBSubnetGroups x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBSubnetGroups' 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:
--
-- 'dbSubnetGroupName', 'describeDBSubnetGroups_dbSubnetGroupName' - The name of the DB subnet group to return details for.
--
-- 'filters', 'describeDBSubnetGroups_filters' - This parameter isn\'t currently supported.
--
-- 'marker', 'describeDBSubnetGroups_marker' - An optional pagination token provided by a previous
-- DescribeDBSubnetGroups request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by @MaxRecords@.
--
-- 'maxRecords', 'describeDBSubnetGroups_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so that you can retrieve the
-- remaining results.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
newDescribeDBSubnetGroups ::
  DescribeDBSubnetGroups
newDescribeDBSubnetGroups :: DescribeDBSubnetGroups
newDescribeDBSubnetGroups =
  DescribeDBSubnetGroups' :: Maybe Text
-> Maybe [Filter]
-> Maybe Text
-> Maybe Int
-> DescribeDBSubnetGroups
DescribeDBSubnetGroups'
    { $sel:dbSubnetGroupName:DescribeDBSubnetGroups' :: Maybe Text
dbSubnetGroupName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeDBSubnetGroups' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBSubnetGroups' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeDBSubnetGroups' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the DB subnet group to return details for.
describeDBSubnetGroups_dbSubnetGroupName :: Lens.Lens' DescribeDBSubnetGroups (Prelude.Maybe Prelude.Text)
describeDBSubnetGroups_dbSubnetGroupName :: (Maybe Text -> f (Maybe Text))
-> DescribeDBSubnetGroups -> f DescribeDBSubnetGroups
describeDBSubnetGroups_dbSubnetGroupName = (DescribeDBSubnetGroups -> Maybe Text)
-> (DescribeDBSubnetGroups -> Maybe Text -> DescribeDBSubnetGroups)
-> Lens
     DescribeDBSubnetGroups
     DescribeDBSubnetGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBSubnetGroups' {Maybe Text
dbSubnetGroupName :: Maybe Text
$sel:dbSubnetGroupName:DescribeDBSubnetGroups' :: DescribeDBSubnetGroups -> Maybe Text
dbSubnetGroupName} -> Maybe Text
dbSubnetGroupName) (\s :: DescribeDBSubnetGroups
s@DescribeDBSubnetGroups' {} Maybe Text
a -> DescribeDBSubnetGroups
s {$sel:dbSubnetGroupName:DescribeDBSubnetGroups' :: Maybe Text
dbSubnetGroupName = Maybe Text
a} :: DescribeDBSubnetGroups)

-- | This parameter isn\'t currently supported.
describeDBSubnetGroups_filters :: Lens.Lens' DescribeDBSubnetGroups (Prelude.Maybe [Filter])
describeDBSubnetGroups_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBSubnetGroups -> f DescribeDBSubnetGroups
describeDBSubnetGroups_filters = (DescribeDBSubnetGroups -> Maybe [Filter])
-> (DescribeDBSubnetGroups
    -> Maybe [Filter] -> DescribeDBSubnetGroups)
-> Lens
     DescribeDBSubnetGroups
     DescribeDBSubnetGroups
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBSubnetGroups' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeDBSubnetGroups' :: DescribeDBSubnetGroups -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeDBSubnetGroups
s@DescribeDBSubnetGroups' {} Maybe [Filter]
a -> DescribeDBSubnetGroups
s {$sel:filters:DescribeDBSubnetGroups' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeDBSubnetGroups) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeDBSubnetGroups -> f DescribeDBSubnetGroups)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBSubnetGroups
-> f DescribeDBSubnetGroups
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

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

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

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

instance Prelude.NFData DescribeDBSubnetGroups

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

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

instance Core.ToQuery DescribeDBSubnetGroups where
  toQuery :: DescribeDBSubnetGroups -> QueryString
toQuery DescribeDBSubnetGroups' {Maybe Int
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
filters :: Maybe [Filter]
dbSubnetGroupName :: Maybe Text
$sel:maxRecords:DescribeDBSubnetGroups' :: DescribeDBSubnetGroups -> Maybe Int
$sel:marker:DescribeDBSubnetGroups' :: DescribeDBSubnetGroups -> Maybe Text
$sel:filters:DescribeDBSubnetGroups' :: DescribeDBSubnetGroups -> Maybe [Filter]
$sel:dbSubnetGroupName:DescribeDBSubnetGroups' :: DescribeDBSubnetGroups -> 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
"DescribeDBSubnetGroups" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBSubnetGroupName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
dbSubnetGroupName,
        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
"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
      ]

-- | Contains the result of a successful invocation of the
-- @DescribeDBSubnetGroups@ action.
--
-- /See:/ 'newDescribeDBSubnetGroupsResponse' smart constructor.
data DescribeDBSubnetGroupsResponse = DescribeDBSubnetGroupsResponse'
  { -- | A list of @DBSubnetGroup@ instances.
    DescribeDBSubnetGroupsResponse -> Maybe [DBSubnetGroup]
dbSubnetGroups :: Prelude.Maybe [DBSubnetGroup],
    -- | 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@.
    DescribeDBSubnetGroupsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeDBSubnetGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDBSubnetGroupsResponse
-> DescribeDBSubnetGroupsResponse -> Bool
(DescribeDBSubnetGroupsResponse
 -> DescribeDBSubnetGroupsResponse -> Bool)
-> (DescribeDBSubnetGroupsResponse
    -> DescribeDBSubnetGroupsResponse -> Bool)
-> Eq DescribeDBSubnetGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBSubnetGroupsResponse
-> DescribeDBSubnetGroupsResponse -> Bool
$c/= :: DescribeDBSubnetGroupsResponse
-> DescribeDBSubnetGroupsResponse -> Bool
== :: DescribeDBSubnetGroupsResponse
-> DescribeDBSubnetGroupsResponse -> Bool
$c== :: DescribeDBSubnetGroupsResponse
-> DescribeDBSubnetGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDBSubnetGroupsResponse]
ReadPrec DescribeDBSubnetGroupsResponse
Int -> ReadS DescribeDBSubnetGroupsResponse
ReadS [DescribeDBSubnetGroupsResponse]
(Int -> ReadS DescribeDBSubnetGroupsResponse)
-> ReadS [DescribeDBSubnetGroupsResponse]
-> ReadPrec DescribeDBSubnetGroupsResponse
-> ReadPrec [DescribeDBSubnetGroupsResponse]
-> Read DescribeDBSubnetGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBSubnetGroupsResponse]
$creadListPrec :: ReadPrec [DescribeDBSubnetGroupsResponse]
readPrec :: ReadPrec DescribeDBSubnetGroupsResponse
$creadPrec :: ReadPrec DescribeDBSubnetGroupsResponse
readList :: ReadS [DescribeDBSubnetGroupsResponse]
$creadList :: ReadS [DescribeDBSubnetGroupsResponse]
readsPrec :: Int -> ReadS DescribeDBSubnetGroupsResponse
$creadsPrec :: Int -> ReadS DescribeDBSubnetGroupsResponse
Prelude.Read, Int -> DescribeDBSubnetGroupsResponse -> ShowS
[DescribeDBSubnetGroupsResponse] -> ShowS
DescribeDBSubnetGroupsResponse -> String
(Int -> DescribeDBSubnetGroupsResponse -> ShowS)
-> (DescribeDBSubnetGroupsResponse -> String)
-> ([DescribeDBSubnetGroupsResponse] -> ShowS)
-> Show DescribeDBSubnetGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBSubnetGroupsResponse] -> ShowS
$cshowList :: [DescribeDBSubnetGroupsResponse] -> ShowS
show :: DescribeDBSubnetGroupsResponse -> String
$cshow :: DescribeDBSubnetGroupsResponse -> String
showsPrec :: Int -> DescribeDBSubnetGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribeDBSubnetGroupsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDBSubnetGroupsResponse
 -> Rep DescribeDBSubnetGroupsResponse x)
-> (forall x.
    Rep DescribeDBSubnetGroupsResponse x
    -> DescribeDBSubnetGroupsResponse)
-> Generic DescribeDBSubnetGroupsResponse
forall x.
Rep DescribeDBSubnetGroupsResponse x
-> DescribeDBSubnetGroupsResponse
forall x.
DescribeDBSubnetGroupsResponse
-> Rep DescribeDBSubnetGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDBSubnetGroupsResponse x
-> DescribeDBSubnetGroupsResponse
$cfrom :: forall x.
DescribeDBSubnetGroupsResponse
-> Rep DescribeDBSubnetGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBSubnetGroupsResponse' 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:
--
-- 'dbSubnetGroups', 'describeDBSubnetGroupsResponse_dbSubnetGroups' - A list of @DBSubnetGroup@ instances.
--
-- 'marker', 'describeDBSubnetGroupsResponse_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', 'describeDBSubnetGroupsResponse_httpStatus' - The response's http status code.
newDescribeDBSubnetGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDBSubnetGroupsResponse
newDescribeDBSubnetGroupsResponse :: Int -> DescribeDBSubnetGroupsResponse
newDescribeDBSubnetGroupsResponse Int
pHttpStatus_ =
  DescribeDBSubnetGroupsResponse' :: Maybe [DBSubnetGroup]
-> Maybe Text -> Int -> DescribeDBSubnetGroupsResponse
DescribeDBSubnetGroupsResponse'
    { $sel:dbSubnetGroups:DescribeDBSubnetGroupsResponse' :: Maybe [DBSubnetGroup]
dbSubnetGroups =
        Maybe [DBSubnetGroup]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBSubnetGroupsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDBSubnetGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of @DBSubnetGroup@ instances.
describeDBSubnetGroupsResponse_dbSubnetGroups :: Lens.Lens' DescribeDBSubnetGroupsResponse (Prelude.Maybe [DBSubnetGroup])
describeDBSubnetGroupsResponse_dbSubnetGroups :: (Maybe [DBSubnetGroup] -> f (Maybe [DBSubnetGroup]))
-> DescribeDBSubnetGroupsResponse
-> f DescribeDBSubnetGroupsResponse
describeDBSubnetGroupsResponse_dbSubnetGroups = (DescribeDBSubnetGroupsResponse -> Maybe [DBSubnetGroup])
-> (DescribeDBSubnetGroupsResponse
    -> Maybe [DBSubnetGroup] -> DescribeDBSubnetGroupsResponse)
-> Lens' DescribeDBSubnetGroupsResponse (Maybe [DBSubnetGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBSubnetGroupsResponse' {Maybe [DBSubnetGroup]
dbSubnetGroups :: Maybe [DBSubnetGroup]
$sel:dbSubnetGroups:DescribeDBSubnetGroupsResponse' :: DescribeDBSubnetGroupsResponse -> Maybe [DBSubnetGroup]
dbSubnetGroups} -> Maybe [DBSubnetGroup]
dbSubnetGroups) (\s :: DescribeDBSubnetGroupsResponse
s@DescribeDBSubnetGroupsResponse' {} Maybe [DBSubnetGroup]
a -> DescribeDBSubnetGroupsResponse
s {$sel:dbSubnetGroups:DescribeDBSubnetGroupsResponse' :: Maybe [DBSubnetGroup]
dbSubnetGroups = Maybe [DBSubnetGroup]
a} :: DescribeDBSubnetGroupsResponse) ((Maybe [DBSubnetGroup] -> f (Maybe [DBSubnetGroup]))
 -> DescribeDBSubnetGroupsResponse
 -> f DescribeDBSubnetGroupsResponse)
-> ((Maybe [DBSubnetGroup] -> f (Maybe [DBSubnetGroup]))
    -> Maybe [DBSubnetGroup] -> f (Maybe [DBSubnetGroup]))
-> (Maybe [DBSubnetGroup] -> f (Maybe [DBSubnetGroup]))
-> DescribeDBSubnetGroupsResponse
-> f DescribeDBSubnetGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DBSubnetGroup] [DBSubnetGroup] [DBSubnetGroup] [DBSubnetGroup]
-> Iso
     (Maybe [DBSubnetGroup])
     (Maybe [DBSubnetGroup])
     (Maybe [DBSubnetGroup])
     (Maybe [DBSubnetGroup])
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
  [DBSubnetGroup] [DBSubnetGroup] [DBSubnetGroup] [DBSubnetGroup]
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@.
describeDBSubnetGroupsResponse_marker :: Lens.Lens' DescribeDBSubnetGroupsResponse (Prelude.Maybe Prelude.Text)
describeDBSubnetGroupsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDBSubnetGroupsResponse
-> f DescribeDBSubnetGroupsResponse
describeDBSubnetGroupsResponse_marker = (DescribeDBSubnetGroupsResponse -> Maybe Text)
-> (DescribeDBSubnetGroupsResponse
    -> Maybe Text -> DescribeDBSubnetGroupsResponse)
-> Lens' DescribeDBSubnetGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBSubnetGroupsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDBSubnetGroupsResponse' :: DescribeDBSubnetGroupsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDBSubnetGroupsResponse
s@DescribeDBSubnetGroupsResponse' {} Maybe Text
a -> DescribeDBSubnetGroupsResponse
s {$sel:marker:DescribeDBSubnetGroupsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeDBSubnetGroupsResponse)

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

instance
  Prelude.NFData
    DescribeDBSubnetGroupsResponse