{-# 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.DescribeDBSecurityGroups
-- 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 @DBSecurityGroup@ descriptions. If a
-- @DBSecurityGroupName@ is specified, the list will contain only the
-- descriptions of the specified DB security group.
--
-- This operation returns paginated results.
module Amazonka.RDS.DescribeDBSecurityGroups
  ( -- * Creating a Request
    DescribeDBSecurityGroups (..),
    newDescribeDBSecurityGroups,

    -- * Request Lenses
    describeDBSecurityGroups_filters,
    describeDBSecurityGroups_marker,
    describeDBSecurityGroups_maxRecords,
    describeDBSecurityGroups_dbSecurityGroupName,

    -- * Destructuring the Response
    DescribeDBSecurityGroupsResponse (..),
    newDescribeDBSecurityGroupsResponse,

    -- * Response Lenses
    describeDBSecurityGroupsResponse_dbSecurityGroups,
    describeDBSecurityGroupsResponse_marker,
    describeDBSecurityGroupsResponse_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:/ 'newDescribeDBSecurityGroups' smart constructor.
data DescribeDBSecurityGroups = DescribeDBSecurityGroups'
  { -- | This parameter isn\'t currently supported.
    DescribeDBSecurityGroups -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An optional pagination token provided by a previous
    -- @DescribeDBSecurityGroups@ request. If this parameter is specified, the
    -- response includes only records beyond the marker, up to the value
    -- specified by @MaxRecords@.
    DescribeDBSecurityGroups -> 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.
    DescribeDBSecurityGroups -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The name of the DB security group to return details for.
    DescribeDBSecurityGroups -> Maybe Text
dbSecurityGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeDBSecurityGroups -> DescribeDBSecurityGroups -> Bool
(DescribeDBSecurityGroups -> DescribeDBSecurityGroups -> Bool)
-> (DescribeDBSecurityGroups -> DescribeDBSecurityGroups -> Bool)
-> Eq DescribeDBSecurityGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBSecurityGroups -> DescribeDBSecurityGroups -> Bool
$c/= :: DescribeDBSecurityGroups -> DescribeDBSecurityGroups -> Bool
== :: DescribeDBSecurityGroups -> DescribeDBSecurityGroups -> Bool
$c== :: DescribeDBSecurityGroups -> DescribeDBSecurityGroups -> Bool
Prelude.Eq, ReadPrec [DescribeDBSecurityGroups]
ReadPrec DescribeDBSecurityGroups
Int -> ReadS DescribeDBSecurityGroups
ReadS [DescribeDBSecurityGroups]
(Int -> ReadS DescribeDBSecurityGroups)
-> ReadS [DescribeDBSecurityGroups]
-> ReadPrec DescribeDBSecurityGroups
-> ReadPrec [DescribeDBSecurityGroups]
-> Read DescribeDBSecurityGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBSecurityGroups]
$creadListPrec :: ReadPrec [DescribeDBSecurityGroups]
readPrec :: ReadPrec DescribeDBSecurityGroups
$creadPrec :: ReadPrec DescribeDBSecurityGroups
readList :: ReadS [DescribeDBSecurityGroups]
$creadList :: ReadS [DescribeDBSecurityGroups]
readsPrec :: Int -> ReadS DescribeDBSecurityGroups
$creadsPrec :: Int -> ReadS DescribeDBSecurityGroups
Prelude.Read, Int -> DescribeDBSecurityGroups -> ShowS
[DescribeDBSecurityGroups] -> ShowS
DescribeDBSecurityGroups -> String
(Int -> DescribeDBSecurityGroups -> ShowS)
-> (DescribeDBSecurityGroups -> String)
-> ([DescribeDBSecurityGroups] -> ShowS)
-> Show DescribeDBSecurityGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBSecurityGroups] -> ShowS
$cshowList :: [DescribeDBSecurityGroups] -> ShowS
show :: DescribeDBSecurityGroups -> String
$cshow :: DescribeDBSecurityGroups -> String
showsPrec :: Int -> DescribeDBSecurityGroups -> ShowS
$cshowsPrec :: Int -> DescribeDBSecurityGroups -> ShowS
Prelude.Show, (forall x.
 DescribeDBSecurityGroups -> Rep DescribeDBSecurityGroups x)
-> (forall x.
    Rep DescribeDBSecurityGroups x -> DescribeDBSecurityGroups)
-> Generic DescribeDBSecurityGroups
forall x.
Rep DescribeDBSecurityGroups x -> DescribeDBSecurityGroups
forall x.
DescribeDBSecurityGroups -> Rep DescribeDBSecurityGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDBSecurityGroups x -> DescribeDBSecurityGroups
$cfrom :: forall x.
DescribeDBSecurityGroups -> Rep DescribeDBSecurityGroups x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBSecurityGroups' 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', 'describeDBSecurityGroups_filters' - This parameter isn\'t currently supported.
--
-- 'marker', 'describeDBSecurityGroups_marker' - An optional pagination token provided by a previous
-- @DescribeDBSecurityGroups@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by @MaxRecords@.
--
-- 'maxRecords', 'describeDBSecurityGroups_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.
--
-- 'dbSecurityGroupName', 'describeDBSecurityGroups_dbSecurityGroupName' - The name of the DB security group to return details for.
newDescribeDBSecurityGroups ::
  DescribeDBSecurityGroups
newDescribeDBSecurityGroups :: DescribeDBSecurityGroups
newDescribeDBSecurityGroups =
  DescribeDBSecurityGroups' :: Maybe [Filter]
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> DescribeDBSecurityGroups
DescribeDBSecurityGroups'
    { $sel:filters:DescribeDBSecurityGroups' :: Maybe [Filter]
filters =
        Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBSecurityGroups' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeDBSecurityGroups' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:dbSecurityGroupName:DescribeDBSecurityGroups' :: Maybe Text
dbSecurityGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | This parameter isn\'t currently supported.
describeDBSecurityGroups_filters :: Lens.Lens' DescribeDBSecurityGroups (Prelude.Maybe [Filter])
describeDBSecurityGroups_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBSecurityGroups -> f DescribeDBSecurityGroups
describeDBSecurityGroups_filters = (DescribeDBSecurityGroups -> Maybe [Filter])
-> (DescribeDBSecurityGroups
    -> Maybe [Filter] -> DescribeDBSecurityGroups)
-> Lens
     DescribeDBSecurityGroups
     DescribeDBSecurityGroups
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBSecurityGroups' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeDBSecurityGroups' :: DescribeDBSecurityGroups -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeDBSecurityGroups
s@DescribeDBSecurityGroups' {} Maybe [Filter]
a -> DescribeDBSecurityGroups
s {$sel:filters:DescribeDBSecurityGroups' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeDBSecurityGroups) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeDBSecurityGroups -> f DescribeDBSecurityGroups)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBSecurityGroups
-> f DescribeDBSecurityGroups
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
-- @DescribeDBSecurityGroups@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by @MaxRecords@.
describeDBSecurityGroups_marker :: Lens.Lens' DescribeDBSecurityGroups (Prelude.Maybe Prelude.Text)
describeDBSecurityGroups_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDBSecurityGroups -> f DescribeDBSecurityGroups
describeDBSecurityGroups_marker = (DescribeDBSecurityGroups -> Maybe Text)
-> (DescribeDBSecurityGroups
    -> Maybe Text -> DescribeDBSecurityGroups)
-> Lens
     DescribeDBSecurityGroups
     DescribeDBSecurityGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBSecurityGroups' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDBSecurityGroups' :: DescribeDBSecurityGroups -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDBSecurityGroups
s@DescribeDBSecurityGroups' {} Maybe Text
a -> DescribeDBSecurityGroups
s {$sel:marker:DescribeDBSecurityGroups' :: Maybe Text
marker = Maybe Text
a} :: DescribeDBSecurityGroups)

-- | 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.
describeDBSecurityGroups_maxRecords :: Lens.Lens' DescribeDBSecurityGroups (Prelude.Maybe Prelude.Int)
describeDBSecurityGroups_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeDBSecurityGroups -> f DescribeDBSecurityGroups
describeDBSecurityGroups_maxRecords = (DescribeDBSecurityGroups -> Maybe Int)
-> (DescribeDBSecurityGroups
    -> Maybe Int -> DescribeDBSecurityGroups)
-> Lens
     DescribeDBSecurityGroups
     DescribeDBSecurityGroups
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBSecurityGroups' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeDBSecurityGroups' :: DescribeDBSecurityGroups -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeDBSecurityGroups
s@DescribeDBSecurityGroups' {} Maybe Int
a -> DescribeDBSecurityGroups
s {$sel:maxRecords:DescribeDBSecurityGroups' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeDBSecurityGroups)

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

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

instance Prelude.NFData DescribeDBSecurityGroups

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

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

instance Core.ToQuery DescribeDBSecurityGroups where
  toQuery :: DescribeDBSecurityGroups -> QueryString
toQuery DescribeDBSecurityGroups' {Maybe Int
Maybe [Filter]
Maybe Text
dbSecurityGroupName :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
filters :: Maybe [Filter]
$sel:dbSecurityGroupName:DescribeDBSecurityGroups' :: DescribeDBSecurityGroups -> Maybe Text
$sel:maxRecords:DescribeDBSecurityGroups' :: DescribeDBSecurityGroups -> Maybe Int
$sel:marker:DescribeDBSecurityGroups' :: DescribeDBSecurityGroups -> Maybe Text
$sel:filters:DescribeDBSecurityGroups' :: DescribeDBSecurityGroups -> 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
"DescribeDBSecurityGroups" :: 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
"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,
        ByteString
"DBSecurityGroupName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
dbSecurityGroupName
      ]

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

-- |
-- Create a value of 'DescribeDBSecurityGroupsResponse' 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:
--
-- 'dbSecurityGroups', 'describeDBSecurityGroupsResponse_dbSecurityGroups' - A list of @DBSecurityGroup@ instances.
--
-- 'marker', 'describeDBSecurityGroupsResponse_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', 'describeDBSecurityGroupsResponse_httpStatus' - The response's http status code.
newDescribeDBSecurityGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDBSecurityGroupsResponse
newDescribeDBSecurityGroupsResponse :: Int -> DescribeDBSecurityGroupsResponse
newDescribeDBSecurityGroupsResponse Int
pHttpStatus_ =
  DescribeDBSecurityGroupsResponse' :: Maybe [DBSecurityGroup]
-> Maybe Text -> Int -> DescribeDBSecurityGroupsResponse
DescribeDBSecurityGroupsResponse'
    { $sel:dbSecurityGroups:DescribeDBSecurityGroupsResponse' :: Maybe [DBSecurityGroup]
dbSecurityGroups =
        Maybe [DBSecurityGroup]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBSecurityGroupsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDBSecurityGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance
  Prelude.NFData
    DescribeDBSecurityGroupsResponse