{-# 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.ElastiCache.DescribeCacheClusters
-- 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 all provisioned clusters if no cluster
-- identifier is specified, or about a specific cache cluster if a cluster
-- identifier is supplied.
--
-- By default, abbreviated information about the clusters is returned. You
-- can use the optional /ShowCacheNodeInfo/ flag to retrieve detailed
-- information about the cache nodes associated with the clusters. These
-- details include the DNS address and port for the cache node endpoint.
--
-- If the cluster is in the /creating/ state, only cluster-level
-- information is displayed until all of the nodes are successfully
-- provisioned.
--
-- If the cluster is in the /deleting/ state, only cluster-level
-- information is displayed.
--
-- If cache nodes are currently being added to the cluster, node endpoint
-- information and creation time for the additional nodes are not displayed
-- until they are completely provisioned. When the cluster state is
-- /available/, the cluster is ready for use.
--
-- If cache nodes are currently being removed from the cluster, no endpoint
-- information for the removed nodes is displayed.
--
-- This operation returns paginated results.
module Amazonka.ElastiCache.DescribeCacheClusters
  ( -- * Creating a Request
    DescribeCacheClusters (..),
    newDescribeCacheClusters,

    -- * Request Lenses
    describeCacheClusters_showCacheClustersNotInReplicationGroups,
    describeCacheClusters_cacheClusterId,
    describeCacheClusters_marker,
    describeCacheClusters_maxRecords,
    describeCacheClusters_showCacheNodeInfo,

    -- * Destructuring the Response
    DescribeCacheClustersResponse (..),
    newDescribeCacheClustersResponse,

    -- * Response Lenses
    describeCacheClustersResponse_cacheClusters,
    describeCacheClustersResponse_marker,
    describeCacheClustersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.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 of a @DescribeCacheClusters@ operation.
--
-- /See:/ 'newDescribeCacheClusters' smart constructor.
data DescribeCacheClusters = DescribeCacheClusters'
  { -- | An optional flag that can be included in the @DescribeCacheCluster@
    -- request to show only nodes (API\/CLI: clusters) that are not members of
    -- a replication group. In practice, this mean Memcached and single node
    -- Redis clusters.
    DescribeCacheClusters -> Maybe Bool
showCacheClustersNotInReplicationGroups :: Prelude.Maybe Prelude.Bool,
    -- | The user-supplied cluster identifier. If this parameter is specified,
    -- only information about that specific cluster is returned. This parameter
    -- isn\'t case sensitive.
    DescribeCacheClusters -> Maybe Text
cacheClusterId :: Prelude.Maybe Prelude.Text,
    -- | An optional marker returned from a prior request. Use this marker for
    -- pagination of results from this operation. If this parameter is
    -- specified, the response includes only records beyond the marker, up to
    -- the value specified by @MaxRecords@.
    DescribeCacheClusters -> 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 marker is
    -- included in the response so that the remaining results can be retrieved.
    --
    -- Default: 100
    --
    -- Constraints: minimum 20; maximum 100.
    DescribeCacheClusters -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | An optional flag that can be included in the @DescribeCacheCluster@
    -- request to retrieve information about the individual cache nodes.
    DescribeCacheClusters -> Maybe Bool
showCacheNodeInfo :: Prelude.Maybe Prelude.Bool
  }
  deriving (DescribeCacheClusters -> DescribeCacheClusters -> Bool
(DescribeCacheClusters -> DescribeCacheClusters -> Bool)
-> (DescribeCacheClusters -> DescribeCacheClusters -> Bool)
-> Eq DescribeCacheClusters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheClusters -> DescribeCacheClusters -> Bool
$c/= :: DescribeCacheClusters -> DescribeCacheClusters -> Bool
== :: DescribeCacheClusters -> DescribeCacheClusters -> Bool
$c== :: DescribeCacheClusters -> DescribeCacheClusters -> Bool
Prelude.Eq, ReadPrec [DescribeCacheClusters]
ReadPrec DescribeCacheClusters
Int -> ReadS DescribeCacheClusters
ReadS [DescribeCacheClusters]
(Int -> ReadS DescribeCacheClusters)
-> ReadS [DescribeCacheClusters]
-> ReadPrec DescribeCacheClusters
-> ReadPrec [DescribeCacheClusters]
-> Read DescribeCacheClusters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheClusters]
$creadListPrec :: ReadPrec [DescribeCacheClusters]
readPrec :: ReadPrec DescribeCacheClusters
$creadPrec :: ReadPrec DescribeCacheClusters
readList :: ReadS [DescribeCacheClusters]
$creadList :: ReadS [DescribeCacheClusters]
readsPrec :: Int -> ReadS DescribeCacheClusters
$creadsPrec :: Int -> ReadS DescribeCacheClusters
Prelude.Read, Int -> DescribeCacheClusters -> ShowS
[DescribeCacheClusters] -> ShowS
DescribeCacheClusters -> String
(Int -> DescribeCacheClusters -> ShowS)
-> (DescribeCacheClusters -> String)
-> ([DescribeCacheClusters] -> ShowS)
-> Show DescribeCacheClusters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheClusters] -> ShowS
$cshowList :: [DescribeCacheClusters] -> ShowS
show :: DescribeCacheClusters -> String
$cshow :: DescribeCacheClusters -> String
showsPrec :: Int -> DescribeCacheClusters -> ShowS
$cshowsPrec :: Int -> DescribeCacheClusters -> ShowS
Prelude.Show, (forall x. DescribeCacheClusters -> Rep DescribeCacheClusters x)
-> (forall x. Rep DescribeCacheClusters x -> DescribeCacheClusters)
-> Generic DescribeCacheClusters
forall x. Rep DescribeCacheClusters x -> DescribeCacheClusters
forall x. DescribeCacheClusters -> Rep DescribeCacheClusters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCacheClusters x -> DescribeCacheClusters
$cfrom :: forall x. DescribeCacheClusters -> Rep DescribeCacheClusters x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheClusters' 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:
--
-- 'showCacheClustersNotInReplicationGroups', 'describeCacheClusters_showCacheClustersNotInReplicationGroups' - An optional flag that can be included in the @DescribeCacheCluster@
-- request to show only nodes (API\/CLI: clusters) that are not members of
-- a replication group. In practice, this mean Memcached and single node
-- Redis clusters.
--
-- 'cacheClusterId', 'describeCacheClusters_cacheClusterId' - The user-supplied cluster identifier. If this parameter is specified,
-- only information about that specific cluster is returned. This parameter
-- isn\'t case sensitive.
--
-- 'marker', 'describeCacheClusters_marker' - An optional marker returned from a prior request. Use this marker for
-- pagination of results from this operation. If this parameter is
-- specified, the response includes only records beyond the marker, up to
-- the value specified by @MaxRecords@.
--
-- 'maxRecords', 'describeCacheClusters_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a marker is
-- included in the response so that the remaining results can be retrieved.
--
-- Default: 100
--
-- Constraints: minimum 20; maximum 100.
--
-- 'showCacheNodeInfo', 'describeCacheClusters_showCacheNodeInfo' - An optional flag that can be included in the @DescribeCacheCluster@
-- request to retrieve information about the individual cache nodes.
newDescribeCacheClusters ::
  DescribeCacheClusters
newDescribeCacheClusters :: DescribeCacheClusters
newDescribeCacheClusters =
  DescribeCacheClusters' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Bool
-> DescribeCacheClusters
DescribeCacheClusters'
    { $sel:showCacheClustersNotInReplicationGroups:DescribeCacheClusters' :: Maybe Bool
showCacheClustersNotInReplicationGroups =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheClusterId:DescribeCacheClusters' :: Maybe Text
cacheClusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeCacheClusters' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeCacheClusters' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:showCacheNodeInfo:DescribeCacheClusters' :: Maybe Bool
showCacheNodeInfo = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | An optional flag that can be included in the @DescribeCacheCluster@
-- request to show only nodes (API\/CLI: clusters) that are not members of
-- a replication group. In practice, this mean Memcached and single node
-- Redis clusters.
describeCacheClusters_showCacheClustersNotInReplicationGroups :: Lens.Lens' DescribeCacheClusters (Prelude.Maybe Prelude.Bool)
describeCacheClusters_showCacheClustersNotInReplicationGroups :: (Maybe Bool -> f (Maybe Bool))
-> DescribeCacheClusters -> f DescribeCacheClusters
describeCacheClusters_showCacheClustersNotInReplicationGroups = (DescribeCacheClusters -> Maybe Bool)
-> (DescribeCacheClusters -> Maybe Bool -> DescribeCacheClusters)
-> Lens
     DescribeCacheClusters
     DescribeCacheClusters
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheClusters' {Maybe Bool
showCacheClustersNotInReplicationGroups :: Maybe Bool
$sel:showCacheClustersNotInReplicationGroups:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Bool
showCacheClustersNotInReplicationGroups} -> Maybe Bool
showCacheClustersNotInReplicationGroups) (\s :: DescribeCacheClusters
s@DescribeCacheClusters' {} Maybe Bool
a -> DescribeCacheClusters
s {$sel:showCacheClustersNotInReplicationGroups:DescribeCacheClusters' :: Maybe Bool
showCacheClustersNotInReplicationGroups = Maybe Bool
a} :: DescribeCacheClusters)

-- | The user-supplied cluster identifier. If this parameter is specified,
-- only information about that specific cluster is returned. This parameter
-- isn\'t case sensitive.
describeCacheClusters_cacheClusterId :: Lens.Lens' DescribeCacheClusters (Prelude.Maybe Prelude.Text)
describeCacheClusters_cacheClusterId :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheClusters -> f DescribeCacheClusters
describeCacheClusters_cacheClusterId = (DescribeCacheClusters -> Maybe Text)
-> (DescribeCacheClusters -> Maybe Text -> DescribeCacheClusters)
-> Lens
     DescribeCacheClusters
     DescribeCacheClusters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheClusters' {Maybe Text
cacheClusterId :: Maybe Text
$sel:cacheClusterId:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Text
cacheClusterId} -> Maybe Text
cacheClusterId) (\s :: DescribeCacheClusters
s@DescribeCacheClusters' {} Maybe Text
a -> DescribeCacheClusters
s {$sel:cacheClusterId:DescribeCacheClusters' :: Maybe Text
cacheClusterId = Maybe Text
a} :: DescribeCacheClusters)

-- | An optional marker returned from a prior request. Use this marker for
-- pagination of results from this operation. If this parameter is
-- specified, the response includes only records beyond the marker, up to
-- the value specified by @MaxRecords@.
describeCacheClusters_marker :: Lens.Lens' DescribeCacheClusters (Prelude.Maybe Prelude.Text)
describeCacheClusters_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheClusters -> f DescribeCacheClusters
describeCacheClusters_marker = (DescribeCacheClusters -> Maybe Text)
-> (DescribeCacheClusters -> Maybe Text -> DescribeCacheClusters)
-> Lens
     DescribeCacheClusters
     DescribeCacheClusters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheClusters' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeCacheClusters
s@DescribeCacheClusters' {} Maybe Text
a -> DescribeCacheClusters
s {$sel:marker:DescribeCacheClusters' :: Maybe Text
marker = Maybe Text
a} :: DescribeCacheClusters)

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

-- | An optional flag that can be included in the @DescribeCacheCluster@
-- request to retrieve information about the individual cache nodes.
describeCacheClusters_showCacheNodeInfo :: Lens.Lens' DescribeCacheClusters (Prelude.Maybe Prelude.Bool)
describeCacheClusters_showCacheNodeInfo :: (Maybe Bool -> f (Maybe Bool))
-> DescribeCacheClusters -> f DescribeCacheClusters
describeCacheClusters_showCacheNodeInfo = (DescribeCacheClusters -> Maybe Bool)
-> (DescribeCacheClusters -> Maybe Bool -> DescribeCacheClusters)
-> Lens
     DescribeCacheClusters
     DescribeCacheClusters
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheClusters' {Maybe Bool
showCacheNodeInfo :: Maybe Bool
$sel:showCacheNodeInfo:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Bool
showCacheNodeInfo} -> Maybe Bool
showCacheNodeInfo) (\s :: DescribeCacheClusters
s@DescribeCacheClusters' {} Maybe Bool
a -> DescribeCacheClusters
s {$sel:showCacheNodeInfo:DescribeCacheClusters' :: Maybe Bool
showCacheNodeInfo = Maybe Bool
a} :: DescribeCacheClusters)

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

instance Prelude.NFData DescribeCacheClusters

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

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

instance Core.ToQuery DescribeCacheClusters where
  toQuery :: DescribeCacheClusters -> QueryString
toQuery DescribeCacheClusters' {Maybe Bool
Maybe Int
Maybe Text
showCacheNodeInfo :: Maybe Bool
maxRecords :: Maybe Int
marker :: Maybe Text
cacheClusterId :: Maybe Text
showCacheClustersNotInReplicationGroups :: Maybe Bool
$sel:showCacheNodeInfo:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Bool
$sel:maxRecords:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Int
$sel:marker:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Text
$sel:cacheClusterId:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Text
$sel:showCacheClustersNotInReplicationGroups:DescribeCacheClusters' :: DescribeCacheClusters -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeCacheClusters" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"ShowCacheClustersNotInReplicationGroups"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
showCacheClustersNotInReplicationGroups,
        ByteString
"CacheClusterId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
cacheClusterId,
        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
"ShowCacheNodeInfo" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
showCacheNodeInfo
      ]

-- | Represents the output of a @DescribeCacheClusters@ operation.
--
-- /See:/ 'newDescribeCacheClustersResponse' smart constructor.
data DescribeCacheClustersResponse = DescribeCacheClustersResponse'
  { -- | A list of clusters. Each item in the list contains detailed information
    -- about one cluster.
    DescribeCacheClustersResponse -> Maybe [CacheCluster]
cacheClusters :: Prelude.Maybe [CacheCluster],
    -- | Provides an identifier to allow retrieval of paginated results.
    DescribeCacheClustersResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeCacheClustersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCacheClustersResponse
-> DescribeCacheClustersResponse -> Bool
(DescribeCacheClustersResponse
 -> DescribeCacheClustersResponse -> Bool)
-> (DescribeCacheClustersResponse
    -> DescribeCacheClustersResponse -> Bool)
-> Eq DescribeCacheClustersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheClustersResponse
-> DescribeCacheClustersResponse -> Bool
$c/= :: DescribeCacheClustersResponse
-> DescribeCacheClustersResponse -> Bool
== :: DescribeCacheClustersResponse
-> DescribeCacheClustersResponse -> Bool
$c== :: DescribeCacheClustersResponse
-> DescribeCacheClustersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCacheClustersResponse]
ReadPrec DescribeCacheClustersResponse
Int -> ReadS DescribeCacheClustersResponse
ReadS [DescribeCacheClustersResponse]
(Int -> ReadS DescribeCacheClustersResponse)
-> ReadS [DescribeCacheClustersResponse]
-> ReadPrec DescribeCacheClustersResponse
-> ReadPrec [DescribeCacheClustersResponse]
-> Read DescribeCacheClustersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheClustersResponse]
$creadListPrec :: ReadPrec [DescribeCacheClustersResponse]
readPrec :: ReadPrec DescribeCacheClustersResponse
$creadPrec :: ReadPrec DescribeCacheClustersResponse
readList :: ReadS [DescribeCacheClustersResponse]
$creadList :: ReadS [DescribeCacheClustersResponse]
readsPrec :: Int -> ReadS DescribeCacheClustersResponse
$creadsPrec :: Int -> ReadS DescribeCacheClustersResponse
Prelude.Read, Int -> DescribeCacheClustersResponse -> ShowS
[DescribeCacheClustersResponse] -> ShowS
DescribeCacheClustersResponse -> String
(Int -> DescribeCacheClustersResponse -> ShowS)
-> (DescribeCacheClustersResponse -> String)
-> ([DescribeCacheClustersResponse] -> ShowS)
-> Show DescribeCacheClustersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheClustersResponse] -> ShowS
$cshowList :: [DescribeCacheClustersResponse] -> ShowS
show :: DescribeCacheClustersResponse -> String
$cshow :: DescribeCacheClustersResponse -> String
showsPrec :: Int -> DescribeCacheClustersResponse -> ShowS
$cshowsPrec :: Int -> DescribeCacheClustersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeCacheClustersResponse
 -> Rep DescribeCacheClustersResponse x)
-> (forall x.
    Rep DescribeCacheClustersResponse x
    -> DescribeCacheClustersResponse)
-> Generic DescribeCacheClustersResponse
forall x.
Rep DescribeCacheClustersResponse x
-> DescribeCacheClustersResponse
forall x.
DescribeCacheClustersResponse
-> Rep DescribeCacheClustersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCacheClustersResponse x
-> DescribeCacheClustersResponse
$cfrom :: forall x.
DescribeCacheClustersResponse
-> Rep DescribeCacheClustersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheClustersResponse' 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:
--
-- 'cacheClusters', 'describeCacheClustersResponse_cacheClusters' - A list of clusters. Each item in the list contains detailed information
-- about one cluster.
--
-- 'marker', 'describeCacheClustersResponse_marker' - Provides an identifier to allow retrieval of paginated results.
--
-- 'httpStatus', 'describeCacheClustersResponse_httpStatus' - The response's http status code.
newDescribeCacheClustersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCacheClustersResponse
newDescribeCacheClustersResponse :: Int -> DescribeCacheClustersResponse
newDescribeCacheClustersResponse Int
pHttpStatus_ =
  DescribeCacheClustersResponse' :: Maybe [CacheCluster]
-> Maybe Text -> Int -> DescribeCacheClustersResponse
DescribeCacheClustersResponse'
    { $sel:cacheClusters:DescribeCacheClustersResponse' :: Maybe [CacheCluster]
cacheClusters =
        Maybe [CacheCluster]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeCacheClustersResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCacheClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of clusters. Each item in the list contains detailed information
-- about one cluster.
describeCacheClustersResponse_cacheClusters :: Lens.Lens' DescribeCacheClustersResponse (Prelude.Maybe [CacheCluster])
describeCacheClustersResponse_cacheClusters :: (Maybe [CacheCluster] -> f (Maybe [CacheCluster]))
-> DescribeCacheClustersResponse -> f DescribeCacheClustersResponse
describeCacheClustersResponse_cacheClusters = (DescribeCacheClustersResponse -> Maybe [CacheCluster])
-> (DescribeCacheClustersResponse
    -> Maybe [CacheCluster] -> DescribeCacheClustersResponse)
-> Lens' DescribeCacheClustersResponse (Maybe [CacheCluster])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheClustersResponse' {Maybe [CacheCluster]
cacheClusters :: Maybe [CacheCluster]
$sel:cacheClusters:DescribeCacheClustersResponse' :: DescribeCacheClustersResponse -> Maybe [CacheCluster]
cacheClusters} -> Maybe [CacheCluster]
cacheClusters) (\s :: DescribeCacheClustersResponse
s@DescribeCacheClustersResponse' {} Maybe [CacheCluster]
a -> DescribeCacheClustersResponse
s {$sel:cacheClusters:DescribeCacheClustersResponse' :: Maybe [CacheCluster]
cacheClusters = Maybe [CacheCluster]
a} :: DescribeCacheClustersResponse) ((Maybe [CacheCluster] -> f (Maybe [CacheCluster]))
 -> DescribeCacheClustersResponse
 -> f DescribeCacheClustersResponse)
-> ((Maybe [CacheCluster] -> f (Maybe [CacheCluster]))
    -> Maybe [CacheCluster] -> f (Maybe [CacheCluster]))
-> (Maybe [CacheCluster] -> f (Maybe [CacheCluster]))
-> DescribeCacheClustersResponse
-> f DescribeCacheClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CacheCluster] [CacheCluster] [CacheCluster] [CacheCluster]
-> Iso
     (Maybe [CacheCluster])
     (Maybe [CacheCluster])
     (Maybe [CacheCluster])
     (Maybe [CacheCluster])
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 [CacheCluster] [CacheCluster] [CacheCluster] [CacheCluster]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Provides an identifier to allow retrieval of paginated results.
describeCacheClustersResponse_marker :: Lens.Lens' DescribeCacheClustersResponse (Prelude.Maybe Prelude.Text)
describeCacheClustersResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheClustersResponse -> f DescribeCacheClustersResponse
describeCacheClustersResponse_marker = (DescribeCacheClustersResponse -> Maybe Text)
-> (DescribeCacheClustersResponse
    -> Maybe Text -> DescribeCacheClustersResponse)
-> Lens' DescribeCacheClustersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheClustersResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeCacheClustersResponse' :: DescribeCacheClustersResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeCacheClustersResponse
s@DescribeCacheClustersResponse' {} Maybe Text
a -> DescribeCacheClustersResponse
s {$sel:marker:DescribeCacheClustersResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeCacheClustersResponse)

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

instance Prelude.NFData DescribeCacheClustersResponse