{-# 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.DescribeDBClusters
-- 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 clusters. This
-- API operation supports pagination. For certain management features such
-- as cluster and instance lifecycle management, Amazon DocumentDB
-- leverages operational technology that is shared with Amazon RDS and
-- Amazon Neptune. Use the @filterName=engine,Values=docdb@ filter
-- parameter to return only Amazon DocumentDB clusters.
--
-- This operation returns paginated results.
module Amazonka.DocumentDB.DescribeDBClusters
  ( -- * Creating a Request
    DescribeDBClusters (..),
    newDescribeDBClusters,

    -- * Request Lenses
    describeDBClusters_dbClusterIdentifier,
    describeDBClusters_filters,
    describeDBClusters_marker,
    describeDBClusters_maxRecords,

    -- * Destructuring the Response
    DescribeDBClustersResponse (..),
    newDescribeDBClustersResponse,

    -- * Response Lenses
    describeDBClustersResponse_dbClusters,
    describeDBClustersResponse_marker,
    describeDBClustersResponse_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 DescribeDBClusters.
--
-- /See:/ 'newDescribeDBClusters' smart constructor.
data DescribeDBClusters = DescribeDBClusters'
  { -- | The user-provided cluster identifier. If this parameter is specified,
    -- information from only the specific cluster is returned. This parameter
    -- isn\'t case sensitive.
    --
    -- Constraints:
    --
    -- -   If provided, must match an existing @DBClusterIdentifier@.
    DescribeDBClusters -> Maybe Text
dbClusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | A filter that specifies one or more clusters to describe.
    --
    -- Supported filters:
    --
    -- -   @db-cluster-id@ - Accepts cluster identifiers and cluster Amazon
    --     Resource Names (ARNs). The results list only includes information
    --     about the clusters identified by these ARNs.
    DescribeDBClusters -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | 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@.
    DescribeDBClusters -> 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.
    DescribeDBClusters -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeDBClusters -> DescribeDBClusters -> Bool
(DescribeDBClusters -> DescribeDBClusters -> Bool)
-> (DescribeDBClusters -> DescribeDBClusters -> Bool)
-> Eq DescribeDBClusters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBClusters -> DescribeDBClusters -> Bool
$c/= :: DescribeDBClusters -> DescribeDBClusters -> Bool
== :: DescribeDBClusters -> DescribeDBClusters -> Bool
$c== :: DescribeDBClusters -> DescribeDBClusters -> Bool
Prelude.Eq, ReadPrec [DescribeDBClusters]
ReadPrec DescribeDBClusters
Int -> ReadS DescribeDBClusters
ReadS [DescribeDBClusters]
(Int -> ReadS DescribeDBClusters)
-> ReadS [DescribeDBClusters]
-> ReadPrec DescribeDBClusters
-> ReadPrec [DescribeDBClusters]
-> Read DescribeDBClusters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBClusters]
$creadListPrec :: ReadPrec [DescribeDBClusters]
readPrec :: ReadPrec DescribeDBClusters
$creadPrec :: ReadPrec DescribeDBClusters
readList :: ReadS [DescribeDBClusters]
$creadList :: ReadS [DescribeDBClusters]
readsPrec :: Int -> ReadS DescribeDBClusters
$creadsPrec :: Int -> ReadS DescribeDBClusters
Prelude.Read, Int -> DescribeDBClusters -> ShowS
[DescribeDBClusters] -> ShowS
DescribeDBClusters -> String
(Int -> DescribeDBClusters -> ShowS)
-> (DescribeDBClusters -> String)
-> ([DescribeDBClusters] -> ShowS)
-> Show DescribeDBClusters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBClusters] -> ShowS
$cshowList :: [DescribeDBClusters] -> ShowS
show :: DescribeDBClusters -> String
$cshow :: DescribeDBClusters -> String
showsPrec :: Int -> DescribeDBClusters -> ShowS
$cshowsPrec :: Int -> DescribeDBClusters -> ShowS
Prelude.Show, (forall x. DescribeDBClusters -> Rep DescribeDBClusters x)
-> (forall x. Rep DescribeDBClusters x -> DescribeDBClusters)
-> Generic DescribeDBClusters
forall x. Rep DescribeDBClusters x -> DescribeDBClusters
forall x. DescribeDBClusters -> Rep DescribeDBClusters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDBClusters x -> DescribeDBClusters
$cfrom :: forall x. DescribeDBClusters -> Rep DescribeDBClusters x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBClusters' 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:
--
-- 'dbClusterIdentifier', 'describeDBClusters_dbClusterIdentifier' - The user-provided cluster identifier. If this parameter is specified,
-- information from only the specific cluster is returned. This parameter
-- isn\'t case sensitive.
--
-- Constraints:
--
-- -   If provided, must match an existing @DBClusterIdentifier@.
--
-- 'filters', 'describeDBClusters_filters' - A filter that specifies one or more clusters to describe.
--
-- Supported filters:
--
-- -   @db-cluster-id@ - Accepts cluster identifiers and cluster Amazon
--     Resource Names (ARNs). The results list only includes information
--     about the clusters identified by these ARNs.
--
-- 'marker', 'describeDBClusters_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', 'describeDBClusters_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.
newDescribeDBClusters ::
  DescribeDBClusters
newDescribeDBClusters :: DescribeDBClusters
newDescribeDBClusters =
  DescribeDBClusters' :: Maybe Text
-> Maybe [Filter] -> Maybe Text -> Maybe Int -> DescribeDBClusters
DescribeDBClusters'
    { $sel:dbClusterIdentifier:DescribeDBClusters' :: Maybe Text
dbClusterIdentifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeDBClusters' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBClusters' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeDBClusters' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

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

-- | A filter that specifies one or more clusters to describe.
--
-- Supported filters:
--
-- -   @db-cluster-id@ - Accepts cluster identifiers and cluster Amazon
--     Resource Names (ARNs). The results list only includes information
--     about the clusters identified by these ARNs.
describeDBClusters_filters :: Lens.Lens' DescribeDBClusters (Prelude.Maybe [Filter])
describeDBClusters_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBClusters -> f DescribeDBClusters
describeDBClusters_filters = (DescribeDBClusters -> Maybe [Filter])
-> (DescribeDBClusters -> Maybe [Filter] -> DescribeDBClusters)
-> Lens
     DescribeDBClusters
     DescribeDBClusters
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBClusters' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeDBClusters' :: DescribeDBClusters -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeDBClusters
s@DescribeDBClusters' {} Maybe [Filter]
a -> DescribeDBClusters
s {$sel:filters:DescribeDBClusters' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeDBClusters) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeDBClusters -> f DescribeDBClusters)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBClusters
-> f DescribeDBClusters
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 request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
describeDBClusters_marker :: Lens.Lens' DescribeDBClusters (Prelude.Maybe Prelude.Text)
describeDBClusters_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDBClusters -> f DescribeDBClusters
describeDBClusters_marker = (DescribeDBClusters -> Maybe Text)
-> (DescribeDBClusters -> Maybe Text -> DescribeDBClusters)
-> Lens
     DescribeDBClusters DescribeDBClusters (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBClusters' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDBClusters' :: DescribeDBClusters -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDBClusters
s@DescribeDBClusters' {} Maybe Text
a -> DescribeDBClusters
s {$sel:marker:DescribeDBClusters' :: Maybe Text
marker = Maybe Text
a} :: DescribeDBClusters)

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

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

instance Prelude.NFData DescribeDBClusters

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

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

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

-- | Represents the output of DescribeDBClusters.
--
-- /See:/ 'newDescribeDBClustersResponse' smart constructor.
data DescribeDBClustersResponse = DescribeDBClustersResponse'
  { -- | A list of clusters.
    DescribeDBClustersResponse -> Maybe [DBCluster]
dbClusters :: Prelude.Maybe [DBCluster],
    -- | 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@.
    DescribeDBClustersResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeDBClustersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDBClustersResponse -> DescribeDBClustersResponse -> Bool
(DescribeDBClustersResponse -> DescribeDBClustersResponse -> Bool)
-> (DescribeDBClustersResponse
    -> DescribeDBClustersResponse -> Bool)
-> Eq DescribeDBClustersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBClustersResponse -> DescribeDBClustersResponse -> Bool
$c/= :: DescribeDBClustersResponse -> DescribeDBClustersResponse -> Bool
== :: DescribeDBClustersResponse -> DescribeDBClustersResponse -> Bool
$c== :: DescribeDBClustersResponse -> DescribeDBClustersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDBClustersResponse]
ReadPrec DescribeDBClustersResponse
Int -> ReadS DescribeDBClustersResponse
ReadS [DescribeDBClustersResponse]
(Int -> ReadS DescribeDBClustersResponse)
-> ReadS [DescribeDBClustersResponse]
-> ReadPrec DescribeDBClustersResponse
-> ReadPrec [DescribeDBClustersResponse]
-> Read DescribeDBClustersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBClustersResponse]
$creadListPrec :: ReadPrec [DescribeDBClustersResponse]
readPrec :: ReadPrec DescribeDBClustersResponse
$creadPrec :: ReadPrec DescribeDBClustersResponse
readList :: ReadS [DescribeDBClustersResponse]
$creadList :: ReadS [DescribeDBClustersResponse]
readsPrec :: Int -> ReadS DescribeDBClustersResponse
$creadsPrec :: Int -> ReadS DescribeDBClustersResponse
Prelude.Read, Int -> DescribeDBClustersResponse -> ShowS
[DescribeDBClustersResponse] -> ShowS
DescribeDBClustersResponse -> String
(Int -> DescribeDBClustersResponse -> ShowS)
-> (DescribeDBClustersResponse -> String)
-> ([DescribeDBClustersResponse] -> ShowS)
-> Show DescribeDBClustersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBClustersResponse] -> ShowS
$cshowList :: [DescribeDBClustersResponse] -> ShowS
show :: DescribeDBClustersResponse -> String
$cshow :: DescribeDBClustersResponse -> String
showsPrec :: Int -> DescribeDBClustersResponse -> ShowS
$cshowsPrec :: Int -> DescribeDBClustersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDBClustersResponse -> Rep DescribeDBClustersResponse x)
-> (forall x.
    Rep DescribeDBClustersResponse x -> DescribeDBClustersResponse)
-> Generic DescribeDBClustersResponse
forall x.
Rep DescribeDBClustersResponse x -> DescribeDBClustersResponse
forall x.
DescribeDBClustersResponse -> Rep DescribeDBClustersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDBClustersResponse x -> DescribeDBClustersResponse
$cfrom :: forall x.
DescribeDBClustersResponse -> Rep DescribeDBClustersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBClustersResponse' 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:
--
-- 'dbClusters', 'describeDBClustersResponse_dbClusters' - A list of clusters.
--
-- 'marker', 'describeDBClustersResponse_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', 'describeDBClustersResponse_httpStatus' - The response's http status code.
newDescribeDBClustersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDBClustersResponse
newDescribeDBClustersResponse :: Int -> DescribeDBClustersResponse
newDescribeDBClustersResponse Int
pHttpStatus_ =
  DescribeDBClustersResponse' :: Maybe [DBCluster]
-> Maybe Text -> Int -> DescribeDBClustersResponse
DescribeDBClustersResponse'
    { $sel:dbClusters:DescribeDBClustersResponse' :: Maybe [DBCluster]
dbClusters =
        Maybe [DBCluster]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBClustersResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDBClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of clusters.
describeDBClustersResponse_dbClusters :: Lens.Lens' DescribeDBClustersResponse (Prelude.Maybe [DBCluster])
describeDBClustersResponse_dbClusters :: (Maybe [DBCluster] -> f (Maybe [DBCluster]))
-> DescribeDBClustersResponse -> f DescribeDBClustersResponse
describeDBClustersResponse_dbClusters = (DescribeDBClustersResponse -> Maybe [DBCluster])
-> (DescribeDBClustersResponse
    -> Maybe [DBCluster] -> DescribeDBClustersResponse)
-> Lens' DescribeDBClustersResponse (Maybe [DBCluster])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBClustersResponse' {Maybe [DBCluster]
dbClusters :: Maybe [DBCluster]
$sel:dbClusters:DescribeDBClustersResponse' :: DescribeDBClustersResponse -> Maybe [DBCluster]
dbClusters} -> Maybe [DBCluster]
dbClusters) (\s :: DescribeDBClustersResponse
s@DescribeDBClustersResponse' {} Maybe [DBCluster]
a -> DescribeDBClustersResponse
s {$sel:dbClusters:DescribeDBClustersResponse' :: Maybe [DBCluster]
dbClusters = Maybe [DBCluster]
a} :: DescribeDBClustersResponse) ((Maybe [DBCluster] -> f (Maybe [DBCluster]))
 -> DescribeDBClustersResponse -> f DescribeDBClustersResponse)
-> ((Maybe [DBCluster] -> f (Maybe [DBCluster]))
    -> Maybe [DBCluster] -> f (Maybe [DBCluster]))
-> (Maybe [DBCluster] -> f (Maybe [DBCluster]))
-> DescribeDBClustersResponse
-> f DescribeDBClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DBCluster] [DBCluster] [DBCluster] [DBCluster]
-> Iso
     (Maybe [DBCluster])
     (Maybe [DBCluster])
     (Maybe [DBCluster])
     (Maybe [DBCluster])
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 [DBCluster] [DBCluster] [DBCluster] [DBCluster]
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@.
describeDBClustersResponse_marker :: Lens.Lens' DescribeDBClustersResponse (Prelude.Maybe Prelude.Text)
describeDBClustersResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDBClustersResponse -> f DescribeDBClustersResponse
describeDBClustersResponse_marker = (DescribeDBClustersResponse -> Maybe Text)
-> (DescribeDBClustersResponse
    -> Maybe Text -> DescribeDBClustersResponse)
-> Lens' DescribeDBClustersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBClustersResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDBClustersResponse' :: DescribeDBClustersResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDBClustersResponse
s@DescribeDBClustersResponse' {} Maybe Text
a -> DescribeDBClustersResponse
s {$sel:marker:DescribeDBClustersResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeDBClustersResponse)

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

instance Prelude.NFData DescribeDBClustersResponse