{-# 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.DescribeCacheEngineVersions
-- 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 the available cache engines and their versions.
--
-- This operation returns paginated results.
module Amazonka.ElastiCache.DescribeCacheEngineVersions
  ( -- * Creating a Request
    DescribeCacheEngineVersions (..),
    newDescribeCacheEngineVersions,

    -- * Request Lenses
    describeCacheEngineVersions_engineVersion,
    describeCacheEngineVersions_cacheParameterGroupFamily,
    describeCacheEngineVersions_defaultOnly,
    describeCacheEngineVersions_engine,
    describeCacheEngineVersions_marker,
    describeCacheEngineVersions_maxRecords,

    -- * Destructuring the Response
    DescribeCacheEngineVersionsResponse (..),
    newDescribeCacheEngineVersionsResponse,

    -- * Response Lenses
    describeCacheEngineVersionsResponse_cacheEngineVersions,
    describeCacheEngineVersionsResponse_marker,
    describeCacheEngineVersionsResponse_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 @DescribeCacheEngineVersions@ operation.
--
-- /See:/ 'newDescribeCacheEngineVersions' smart constructor.
data DescribeCacheEngineVersions = DescribeCacheEngineVersions'
  { -- | The cache engine version to return.
    --
    -- Example: @1.4.14@
    DescribeCacheEngineVersions -> Maybe Text
engineVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of a specific cache parameter group family to return details
    -- for.
    --
    -- Valid values are: @memcached1.4@ | @memcached1.5@ | @memcached1.6@ |
    -- @redis2.6@ | @redis2.8@ | @redis3.2@ | @redis4.0@ | @redis5.0@ |
    -- @redis6.x@ |
    --
    -- Constraints:
    --
    -- -   Must be 1 to 255 alphanumeric characters
    --
    -- -   First character must be a letter
    --
    -- -   Cannot end with a hyphen or contain two consecutive hyphens
    DescribeCacheEngineVersions -> Maybe Text
cacheParameterGroupFamily :: Prelude.Maybe Prelude.Text,
    -- | If @true@, specifies that only the default version of the specified
    -- engine or engine and major version combination is to be returned.
    DescribeCacheEngineVersions -> Maybe Bool
defaultOnly :: Prelude.Maybe Prelude.Bool,
    -- | The cache engine to return. Valid values: @memcached@ | @redis@
    DescribeCacheEngineVersions -> Maybe Text
engine :: 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@.
    DescribeCacheEngineVersions -> 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.
    DescribeCacheEngineVersions -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeCacheEngineVersions -> DescribeCacheEngineVersions -> Bool
(DescribeCacheEngineVersions
 -> DescribeCacheEngineVersions -> Bool)
-> (DescribeCacheEngineVersions
    -> DescribeCacheEngineVersions -> Bool)
-> Eq DescribeCacheEngineVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheEngineVersions -> DescribeCacheEngineVersions -> Bool
$c/= :: DescribeCacheEngineVersions -> DescribeCacheEngineVersions -> Bool
== :: DescribeCacheEngineVersions -> DescribeCacheEngineVersions -> Bool
$c== :: DescribeCacheEngineVersions -> DescribeCacheEngineVersions -> Bool
Prelude.Eq, ReadPrec [DescribeCacheEngineVersions]
ReadPrec DescribeCacheEngineVersions
Int -> ReadS DescribeCacheEngineVersions
ReadS [DescribeCacheEngineVersions]
(Int -> ReadS DescribeCacheEngineVersions)
-> ReadS [DescribeCacheEngineVersions]
-> ReadPrec DescribeCacheEngineVersions
-> ReadPrec [DescribeCacheEngineVersions]
-> Read DescribeCacheEngineVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheEngineVersions]
$creadListPrec :: ReadPrec [DescribeCacheEngineVersions]
readPrec :: ReadPrec DescribeCacheEngineVersions
$creadPrec :: ReadPrec DescribeCacheEngineVersions
readList :: ReadS [DescribeCacheEngineVersions]
$creadList :: ReadS [DescribeCacheEngineVersions]
readsPrec :: Int -> ReadS DescribeCacheEngineVersions
$creadsPrec :: Int -> ReadS DescribeCacheEngineVersions
Prelude.Read, Int -> DescribeCacheEngineVersions -> ShowS
[DescribeCacheEngineVersions] -> ShowS
DescribeCacheEngineVersions -> String
(Int -> DescribeCacheEngineVersions -> ShowS)
-> (DescribeCacheEngineVersions -> String)
-> ([DescribeCacheEngineVersions] -> ShowS)
-> Show DescribeCacheEngineVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheEngineVersions] -> ShowS
$cshowList :: [DescribeCacheEngineVersions] -> ShowS
show :: DescribeCacheEngineVersions -> String
$cshow :: DescribeCacheEngineVersions -> String
showsPrec :: Int -> DescribeCacheEngineVersions -> ShowS
$cshowsPrec :: Int -> DescribeCacheEngineVersions -> ShowS
Prelude.Show, (forall x.
 DescribeCacheEngineVersions -> Rep DescribeCacheEngineVersions x)
-> (forall x.
    Rep DescribeCacheEngineVersions x -> DescribeCacheEngineVersions)
-> Generic DescribeCacheEngineVersions
forall x.
Rep DescribeCacheEngineVersions x -> DescribeCacheEngineVersions
forall x.
DescribeCacheEngineVersions -> Rep DescribeCacheEngineVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCacheEngineVersions x -> DescribeCacheEngineVersions
$cfrom :: forall x.
DescribeCacheEngineVersions -> Rep DescribeCacheEngineVersions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheEngineVersions' 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:
--
-- 'engineVersion', 'describeCacheEngineVersions_engineVersion' - The cache engine version to return.
--
-- Example: @1.4.14@
--
-- 'cacheParameterGroupFamily', 'describeCacheEngineVersions_cacheParameterGroupFamily' - The name of a specific cache parameter group family to return details
-- for.
--
-- Valid values are: @memcached1.4@ | @memcached1.5@ | @memcached1.6@ |
-- @redis2.6@ | @redis2.8@ | @redis3.2@ | @redis4.0@ | @redis5.0@ |
-- @redis6.x@ |
--
-- Constraints:
--
-- -   Must be 1 to 255 alphanumeric characters
--
-- -   First character must be a letter
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens
--
-- 'defaultOnly', 'describeCacheEngineVersions_defaultOnly' - If @true@, specifies that only the default version of the specified
-- engine or engine and major version combination is to be returned.
--
-- 'engine', 'describeCacheEngineVersions_engine' - The cache engine to return. Valid values: @memcached@ | @redis@
--
-- 'marker', 'describeCacheEngineVersions_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', 'describeCacheEngineVersions_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.
newDescribeCacheEngineVersions ::
  DescribeCacheEngineVersions
newDescribeCacheEngineVersions :: DescribeCacheEngineVersions
newDescribeCacheEngineVersions =
  DescribeCacheEngineVersions' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> DescribeCacheEngineVersions
DescribeCacheEngineVersions'
    { $sel:engineVersion:DescribeCacheEngineVersions' :: Maybe Text
engineVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheParameterGroupFamily:DescribeCacheEngineVersions' :: Maybe Text
cacheParameterGroupFamily = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultOnly:DescribeCacheEngineVersions' :: Maybe Bool
defaultOnly = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:engine:DescribeCacheEngineVersions' :: Maybe Text
engine = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeCacheEngineVersions' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeCacheEngineVersions' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The cache engine version to return.
--
-- Example: @1.4.14@
describeCacheEngineVersions_engineVersion :: Lens.Lens' DescribeCacheEngineVersions (Prelude.Maybe Prelude.Text)
describeCacheEngineVersions_engineVersion :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheEngineVersions -> f DescribeCacheEngineVersions
describeCacheEngineVersions_engineVersion = (DescribeCacheEngineVersions -> Maybe Text)
-> (DescribeCacheEngineVersions
    -> Maybe Text -> DescribeCacheEngineVersions)
-> Lens
     DescribeCacheEngineVersions
     DescribeCacheEngineVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheEngineVersions' {Maybe Text
engineVersion :: Maybe Text
$sel:engineVersion:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Text
engineVersion} -> Maybe Text
engineVersion) (\s :: DescribeCacheEngineVersions
s@DescribeCacheEngineVersions' {} Maybe Text
a -> DescribeCacheEngineVersions
s {$sel:engineVersion:DescribeCacheEngineVersions' :: Maybe Text
engineVersion = Maybe Text
a} :: DescribeCacheEngineVersions)

-- | The name of a specific cache parameter group family to return details
-- for.
--
-- Valid values are: @memcached1.4@ | @memcached1.5@ | @memcached1.6@ |
-- @redis2.6@ | @redis2.8@ | @redis3.2@ | @redis4.0@ | @redis5.0@ |
-- @redis6.x@ |
--
-- Constraints:
--
-- -   Must be 1 to 255 alphanumeric characters
--
-- -   First character must be a letter
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens
describeCacheEngineVersions_cacheParameterGroupFamily :: Lens.Lens' DescribeCacheEngineVersions (Prelude.Maybe Prelude.Text)
describeCacheEngineVersions_cacheParameterGroupFamily :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheEngineVersions -> f DescribeCacheEngineVersions
describeCacheEngineVersions_cacheParameterGroupFamily = (DescribeCacheEngineVersions -> Maybe Text)
-> (DescribeCacheEngineVersions
    -> Maybe Text -> DescribeCacheEngineVersions)
-> Lens
     DescribeCacheEngineVersions
     DescribeCacheEngineVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheEngineVersions' {Maybe Text
cacheParameterGroupFamily :: Maybe Text
$sel:cacheParameterGroupFamily:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Text
cacheParameterGroupFamily} -> Maybe Text
cacheParameterGroupFamily) (\s :: DescribeCacheEngineVersions
s@DescribeCacheEngineVersions' {} Maybe Text
a -> DescribeCacheEngineVersions
s {$sel:cacheParameterGroupFamily:DescribeCacheEngineVersions' :: Maybe Text
cacheParameterGroupFamily = Maybe Text
a} :: DescribeCacheEngineVersions)

-- | If @true@, specifies that only the default version of the specified
-- engine or engine and major version combination is to be returned.
describeCacheEngineVersions_defaultOnly :: Lens.Lens' DescribeCacheEngineVersions (Prelude.Maybe Prelude.Bool)
describeCacheEngineVersions_defaultOnly :: (Maybe Bool -> f (Maybe Bool))
-> DescribeCacheEngineVersions -> f DescribeCacheEngineVersions
describeCacheEngineVersions_defaultOnly = (DescribeCacheEngineVersions -> Maybe Bool)
-> (DescribeCacheEngineVersions
    -> Maybe Bool -> DescribeCacheEngineVersions)
-> Lens
     DescribeCacheEngineVersions
     DescribeCacheEngineVersions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheEngineVersions' {Maybe Bool
defaultOnly :: Maybe Bool
$sel:defaultOnly:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Bool
defaultOnly} -> Maybe Bool
defaultOnly) (\s :: DescribeCacheEngineVersions
s@DescribeCacheEngineVersions' {} Maybe Bool
a -> DescribeCacheEngineVersions
s {$sel:defaultOnly:DescribeCacheEngineVersions' :: Maybe Bool
defaultOnly = Maybe Bool
a} :: DescribeCacheEngineVersions)

-- | The cache engine to return. Valid values: @memcached@ | @redis@
describeCacheEngineVersions_engine :: Lens.Lens' DescribeCacheEngineVersions (Prelude.Maybe Prelude.Text)
describeCacheEngineVersions_engine :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheEngineVersions -> f DescribeCacheEngineVersions
describeCacheEngineVersions_engine = (DescribeCacheEngineVersions -> Maybe Text)
-> (DescribeCacheEngineVersions
    -> Maybe Text -> DescribeCacheEngineVersions)
-> Lens
     DescribeCacheEngineVersions
     DescribeCacheEngineVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheEngineVersions' {Maybe Text
engine :: Maybe Text
$sel:engine:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Text
engine} -> Maybe Text
engine) (\s :: DescribeCacheEngineVersions
s@DescribeCacheEngineVersions' {} Maybe Text
a -> DescribeCacheEngineVersions
s {$sel:engine:DescribeCacheEngineVersions' :: Maybe Text
engine = Maybe Text
a} :: DescribeCacheEngineVersions)

-- | 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@.
describeCacheEngineVersions_marker :: Lens.Lens' DescribeCacheEngineVersions (Prelude.Maybe Prelude.Text)
describeCacheEngineVersions_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheEngineVersions -> f DescribeCacheEngineVersions
describeCacheEngineVersions_marker = (DescribeCacheEngineVersions -> Maybe Text)
-> (DescribeCacheEngineVersions
    -> Maybe Text -> DescribeCacheEngineVersions)
-> Lens
     DescribeCacheEngineVersions
     DescribeCacheEngineVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheEngineVersions' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeCacheEngineVersions
s@DescribeCacheEngineVersions' {} Maybe Text
a -> DescribeCacheEngineVersions
s {$sel:marker:DescribeCacheEngineVersions' :: Maybe Text
marker = Maybe Text
a} :: DescribeCacheEngineVersions)

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

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

instance Prelude.NFData DescribeCacheEngineVersions

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

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

instance Core.ToQuery DescribeCacheEngineVersions where
  toQuery :: DescribeCacheEngineVersions -> QueryString
toQuery DescribeCacheEngineVersions' {Maybe Bool
Maybe Int
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
engine :: Maybe Text
defaultOnly :: Maybe Bool
cacheParameterGroupFamily :: Maybe Text
engineVersion :: Maybe Text
$sel:maxRecords:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Int
$sel:marker:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Text
$sel:engine:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Text
$sel:defaultOnly:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Bool
$sel:cacheParameterGroupFamily:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> Maybe Text
$sel:engineVersion:DescribeCacheEngineVersions' :: DescribeCacheEngineVersions -> 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
"DescribeCacheEngineVersions" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"EngineVersion" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
engineVersion,
        ByteString
"CacheParameterGroupFamily"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
cacheParameterGroupFamily,
        ByteString
"DefaultOnly" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
defaultOnly,
        ByteString
"Engine" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
engine,
        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 a DescribeCacheEngineVersions operation.
--
-- /See:/ 'newDescribeCacheEngineVersionsResponse' smart constructor.
data DescribeCacheEngineVersionsResponse = DescribeCacheEngineVersionsResponse'
  { -- | A list of cache engine version details. Each element in the list
    -- contains detailed information about one cache engine version.
    DescribeCacheEngineVersionsResponse -> Maybe [CacheEngineVersion]
cacheEngineVersions :: Prelude.Maybe [CacheEngineVersion],
    -- | Provides an identifier to allow retrieval of paginated results.
    DescribeCacheEngineVersionsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeCacheEngineVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCacheEngineVersionsResponse
-> DescribeCacheEngineVersionsResponse -> Bool
(DescribeCacheEngineVersionsResponse
 -> DescribeCacheEngineVersionsResponse -> Bool)
-> (DescribeCacheEngineVersionsResponse
    -> DescribeCacheEngineVersionsResponse -> Bool)
-> Eq DescribeCacheEngineVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheEngineVersionsResponse
-> DescribeCacheEngineVersionsResponse -> Bool
$c/= :: DescribeCacheEngineVersionsResponse
-> DescribeCacheEngineVersionsResponse -> Bool
== :: DescribeCacheEngineVersionsResponse
-> DescribeCacheEngineVersionsResponse -> Bool
$c== :: DescribeCacheEngineVersionsResponse
-> DescribeCacheEngineVersionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCacheEngineVersionsResponse]
ReadPrec DescribeCacheEngineVersionsResponse
Int -> ReadS DescribeCacheEngineVersionsResponse
ReadS [DescribeCacheEngineVersionsResponse]
(Int -> ReadS DescribeCacheEngineVersionsResponse)
-> ReadS [DescribeCacheEngineVersionsResponse]
-> ReadPrec DescribeCacheEngineVersionsResponse
-> ReadPrec [DescribeCacheEngineVersionsResponse]
-> Read DescribeCacheEngineVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheEngineVersionsResponse]
$creadListPrec :: ReadPrec [DescribeCacheEngineVersionsResponse]
readPrec :: ReadPrec DescribeCacheEngineVersionsResponse
$creadPrec :: ReadPrec DescribeCacheEngineVersionsResponse
readList :: ReadS [DescribeCacheEngineVersionsResponse]
$creadList :: ReadS [DescribeCacheEngineVersionsResponse]
readsPrec :: Int -> ReadS DescribeCacheEngineVersionsResponse
$creadsPrec :: Int -> ReadS DescribeCacheEngineVersionsResponse
Prelude.Read, Int -> DescribeCacheEngineVersionsResponse -> ShowS
[DescribeCacheEngineVersionsResponse] -> ShowS
DescribeCacheEngineVersionsResponse -> String
(Int -> DescribeCacheEngineVersionsResponse -> ShowS)
-> (DescribeCacheEngineVersionsResponse -> String)
-> ([DescribeCacheEngineVersionsResponse] -> ShowS)
-> Show DescribeCacheEngineVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheEngineVersionsResponse] -> ShowS
$cshowList :: [DescribeCacheEngineVersionsResponse] -> ShowS
show :: DescribeCacheEngineVersionsResponse -> String
$cshow :: DescribeCacheEngineVersionsResponse -> String
showsPrec :: Int -> DescribeCacheEngineVersionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeCacheEngineVersionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeCacheEngineVersionsResponse
 -> Rep DescribeCacheEngineVersionsResponse x)
-> (forall x.
    Rep DescribeCacheEngineVersionsResponse x
    -> DescribeCacheEngineVersionsResponse)
-> Generic DescribeCacheEngineVersionsResponse
forall x.
Rep DescribeCacheEngineVersionsResponse x
-> DescribeCacheEngineVersionsResponse
forall x.
DescribeCacheEngineVersionsResponse
-> Rep DescribeCacheEngineVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCacheEngineVersionsResponse x
-> DescribeCacheEngineVersionsResponse
$cfrom :: forall x.
DescribeCacheEngineVersionsResponse
-> Rep DescribeCacheEngineVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheEngineVersionsResponse' 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:
--
-- 'cacheEngineVersions', 'describeCacheEngineVersionsResponse_cacheEngineVersions' - A list of cache engine version details. Each element in the list
-- contains detailed information about one cache engine version.
--
-- 'marker', 'describeCacheEngineVersionsResponse_marker' - Provides an identifier to allow retrieval of paginated results.
--
-- 'httpStatus', 'describeCacheEngineVersionsResponse_httpStatus' - The response's http status code.
newDescribeCacheEngineVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCacheEngineVersionsResponse
newDescribeCacheEngineVersionsResponse :: Int -> DescribeCacheEngineVersionsResponse
newDescribeCacheEngineVersionsResponse Int
pHttpStatus_ =
  DescribeCacheEngineVersionsResponse' :: Maybe [CacheEngineVersion]
-> Maybe Text -> Int -> DescribeCacheEngineVersionsResponse
DescribeCacheEngineVersionsResponse'
    { $sel:cacheEngineVersions:DescribeCacheEngineVersionsResponse' :: Maybe [CacheEngineVersion]
cacheEngineVersions =
        Maybe [CacheEngineVersion]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeCacheEngineVersionsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCacheEngineVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of cache engine version details. Each element in the list
-- contains detailed information about one cache engine version.
describeCacheEngineVersionsResponse_cacheEngineVersions :: Lens.Lens' DescribeCacheEngineVersionsResponse (Prelude.Maybe [CacheEngineVersion])
describeCacheEngineVersionsResponse_cacheEngineVersions :: (Maybe [CacheEngineVersion] -> f (Maybe [CacheEngineVersion]))
-> DescribeCacheEngineVersionsResponse
-> f DescribeCacheEngineVersionsResponse
describeCacheEngineVersionsResponse_cacheEngineVersions = (DescribeCacheEngineVersionsResponse -> Maybe [CacheEngineVersion])
-> (DescribeCacheEngineVersionsResponse
    -> Maybe [CacheEngineVersion]
    -> DescribeCacheEngineVersionsResponse)
-> Lens'
     DescribeCacheEngineVersionsResponse (Maybe [CacheEngineVersion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheEngineVersionsResponse' {Maybe [CacheEngineVersion]
cacheEngineVersions :: Maybe [CacheEngineVersion]
$sel:cacheEngineVersions:DescribeCacheEngineVersionsResponse' :: DescribeCacheEngineVersionsResponse -> Maybe [CacheEngineVersion]
cacheEngineVersions} -> Maybe [CacheEngineVersion]
cacheEngineVersions) (\s :: DescribeCacheEngineVersionsResponse
s@DescribeCacheEngineVersionsResponse' {} Maybe [CacheEngineVersion]
a -> DescribeCacheEngineVersionsResponse
s {$sel:cacheEngineVersions:DescribeCacheEngineVersionsResponse' :: Maybe [CacheEngineVersion]
cacheEngineVersions = Maybe [CacheEngineVersion]
a} :: DescribeCacheEngineVersionsResponse) ((Maybe [CacheEngineVersion] -> f (Maybe [CacheEngineVersion]))
 -> DescribeCacheEngineVersionsResponse
 -> f DescribeCacheEngineVersionsResponse)
-> ((Maybe [CacheEngineVersion] -> f (Maybe [CacheEngineVersion]))
    -> Maybe [CacheEngineVersion] -> f (Maybe [CacheEngineVersion]))
-> (Maybe [CacheEngineVersion] -> f (Maybe [CacheEngineVersion]))
-> DescribeCacheEngineVersionsResponse
-> f DescribeCacheEngineVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CacheEngineVersion]
  [CacheEngineVersion]
  [CacheEngineVersion]
  [CacheEngineVersion]
-> Iso
     (Maybe [CacheEngineVersion])
     (Maybe [CacheEngineVersion])
     (Maybe [CacheEngineVersion])
     (Maybe [CacheEngineVersion])
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
  [CacheEngineVersion]
  [CacheEngineVersion]
  [CacheEngineVersion]
  [CacheEngineVersion]
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.
describeCacheEngineVersionsResponse_marker :: Lens.Lens' DescribeCacheEngineVersionsResponse (Prelude.Maybe Prelude.Text)
describeCacheEngineVersionsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheEngineVersionsResponse
-> f DescribeCacheEngineVersionsResponse
describeCacheEngineVersionsResponse_marker = (DescribeCacheEngineVersionsResponse -> Maybe Text)
-> (DescribeCacheEngineVersionsResponse
    -> Maybe Text -> DescribeCacheEngineVersionsResponse)
-> Lens' DescribeCacheEngineVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheEngineVersionsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeCacheEngineVersionsResponse' :: DescribeCacheEngineVersionsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeCacheEngineVersionsResponse
s@DescribeCacheEngineVersionsResponse' {} Maybe Text
a -> DescribeCacheEngineVersionsResponse
s {$sel:marker:DescribeCacheEngineVersionsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeCacheEngineVersionsResponse)

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

instance
  Prelude.NFData
    DescribeCacheEngineVersionsResponse