{-# 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.DescribeSnapshots
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about cluster or replication group snapshots. By
-- default, @DescribeSnapshots@ lists all of your snapshots; it can
-- optionally describe a single snapshot, or just the snapshots associated
-- with a particular cache cluster.
--
-- This operation is valid for Redis only.
--
-- This operation returns paginated results.
module Amazonka.ElastiCache.DescribeSnapshots
  ( -- * Creating a Request
    DescribeSnapshots (..),
    newDescribeSnapshots,

    -- * Request Lenses
    describeSnapshots_cacheClusterId,
    describeSnapshots_marker,
    describeSnapshots_maxRecords,
    describeSnapshots_replicationGroupId,
    describeSnapshots_showNodeGroupConfig,
    describeSnapshots_snapshotName,
    describeSnapshots_snapshotSource,

    -- * Destructuring the Response
    DescribeSnapshotsResponse (..),
    newDescribeSnapshotsResponse,

    -- * Response Lenses
    describeSnapshotsResponse_marker,
    describeSnapshotsResponse_snapshots,
    describeSnapshotsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElastiCache.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input of a @DescribeSnapshotsMessage@ operation.
--
-- /See:/ 'newDescribeSnapshots' smart constructor.
data DescribeSnapshots = DescribeSnapshots'
  { -- | A user-supplied cluster identifier. If this parameter is specified, only
    -- snapshots associated with that specific cluster are described.
    DescribeSnapshots -> 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@.
    DescribeSnapshots -> 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: 50
    --
    -- Constraints: minimum 20; maximum 50.
    DescribeSnapshots -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | A user-supplied replication group identifier. If this parameter is
    -- specified, only snapshots associated with that specific replication
    -- group are described.
    DescribeSnapshots -> Maybe Text
replicationGroupId :: Prelude.Maybe Prelude.Text,
    -- | A Boolean value which if true, the node group (shard) configuration is
    -- included in the snapshot description.
    DescribeSnapshots -> Maybe Bool
showNodeGroupConfig :: Prelude.Maybe Prelude.Bool,
    -- | A user-supplied name of the snapshot. If this parameter is specified,
    -- only this snapshot are described.
    DescribeSnapshots -> Maybe Text
snapshotName :: Prelude.Maybe Prelude.Text,
    -- | If set to @system@, the output shows snapshots that were automatically
    -- created by ElastiCache. If set to @user@ the output shows snapshots that
    -- were manually created. If omitted, the output shows both automatically
    -- and manually created snapshots.
    DescribeSnapshots -> Maybe Text
snapshotSource :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeSnapshots -> DescribeSnapshots -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSnapshots -> DescribeSnapshots -> Bool
$c/= :: DescribeSnapshots -> DescribeSnapshots -> Bool
== :: DescribeSnapshots -> DescribeSnapshots -> Bool
$c== :: DescribeSnapshots -> DescribeSnapshots -> Bool
Prelude.Eq, ReadPrec [DescribeSnapshots]
ReadPrec DescribeSnapshots
Int -> ReadS DescribeSnapshots
ReadS [DescribeSnapshots]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSnapshots]
$creadListPrec :: ReadPrec [DescribeSnapshots]
readPrec :: ReadPrec DescribeSnapshots
$creadPrec :: ReadPrec DescribeSnapshots
readList :: ReadS [DescribeSnapshots]
$creadList :: ReadS [DescribeSnapshots]
readsPrec :: Int -> ReadS DescribeSnapshots
$creadsPrec :: Int -> ReadS DescribeSnapshots
Prelude.Read, Int -> DescribeSnapshots -> ShowS
[DescribeSnapshots] -> ShowS
DescribeSnapshots -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSnapshots] -> ShowS
$cshowList :: [DescribeSnapshots] -> ShowS
show :: DescribeSnapshots -> String
$cshow :: DescribeSnapshots -> String
showsPrec :: Int -> DescribeSnapshots -> ShowS
$cshowsPrec :: Int -> DescribeSnapshots -> ShowS
Prelude.Show, forall x. Rep DescribeSnapshots x -> DescribeSnapshots
forall x. DescribeSnapshots -> Rep DescribeSnapshots x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeSnapshots x -> DescribeSnapshots
$cfrom :: forall x. DescribeSnapshots -> Rep DescribeSnapshots x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSnapshots' 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:
--
-- 'cacheClusterId', 'describeSnapshots_cacheClusterId' - A user-supplied cluster identifier. If this parameter is specified, only
-- snapshots associated with that specific cluster are described.
--
-- 'marker', 'describeSnapshots_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', 'describeSnapshots_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: 50
--
-- Constraints: minimum 20; maximum 50.
--
-- 'replicationGroupId', 'describeSnapshots_replicationGroupId' - A user-supplied replication group identifier. If this parameter is
-- specified, only snapshots associated with that specific replication
-- group are described.
--
-- 'showNodeGroupConfig', 'describeSnapshots_showNodeGroupConfig' - A Boolean value which if true, the node group (shard) configuration is
-- included in the snapshot description.
--
-- 'snapshotName', 'describeSnapshots_snapshotName' - A user-supplied name of the snapshot. If this parameter is specified,
-- only this snapshot are described.
--
-- 'snapshotSource', 'describeSnapshots_snapshotSource' - If set to @system@, the output shows snapshots that were automatically
-- created by ElastiCache. If set to @user@ the output shows snapshots that
-- were manually created. If omitted, the output shows both automatically
-- and manually created snapshots.
newDescribeSnapshots ::
  DescribeSnapshots
newDescribeSnapshots :: DescribeSnapshots
newDescribeSnapshots =
  DescribeSnapshots'
    { $sel:cacheClusterId:DescribeSnapshots' :: Maybe Text
cacheClusterId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeSnapshots' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeSnapshots' :: Maybe Int
maxRecords = forall a. Maybe a
Prelude.Nothing,
      $sel:replicationGroupId:DescribeSnapshots' :: Maybe Text
replicationGroupId = forall a. Maybe a
Prelude.Nothing,
      $sel:showNodeGroupConfig:DescribeSnapshots' :: Maybe Bool
showNodeGroupConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotName:DescribeSnapshots' :: Maybe Text
snapshotName = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotSource:DescribeSnapshots' :: Maybe Text
snapshotSource = forall a. Maybe a
Prelude.Nothing
    }

-- | A user-supplied cluster identifier. If this parameter is specified, only
-- snapshots associated with that specific cluster are described.
describeSnapshots_cacheClusterId :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Text)
describeSnapshots_cacheClusterId :: Lens' DescribeSnapshots (Maybe Text)
describeSnapshots_cacheClusterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Text
cacheClusterId :: Maybe Text
$sel:cacheClusterId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
cacheClusterId} -> Maybe Text
cacheClusterId) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Text
a -> DescribeSnapshots
s {$sel:cacheClusterId:DescribeSnapshots' :: Maybe Text
cacheClusterId = Maybe Text
a} :: DescribeSnapshots)

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

-- | 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: 50
--
-- Constraints: minimum 20; maximum 50.
describeSnapshots_maxRecords :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Int)
describeSnapshots_maxRecords :: Lens' DescribeSnapshots (Maybe Int)
describeSnapshots_maxRecords = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeSnapshots' :: DescribeSnapshots -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Int
a -> DescribeSnapshots
s {$sel:maxRecords:DescribeSnapshots' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeSnapshots)

-- | A user-supplied replication group identifier. If this parameter is
-- specified, only snapshots associated with that specific replication
-- group are described.
describeSnapshots_replicationGroupId :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Text)
describeSnapshots_replicationGroupId :: Lens' DescribeSnapshots (Maybe Text)
describeSnapshots_replicationGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Text
replicationGroupId :: Maybe Text
$sel:replicationGroupId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
replicationGroupId} -> Maybe Text
replicationGroupId) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Text
a -> DescribeSnapshots
s {$sel:replicationGroupId:DescribeSnapshots' :: Maybe Text
replicationGroupId = Maybe Text
a} :: DescribeSnapshots)

-- | A Boolean value which if true, the node group (shard) configuration is
-- included in the snapshot description.
describeSnapshots_showNodeGroupConfig :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Bool)
describeSnapshots_showNodeGroupConfig :: Lens' DescribeSnapshots (Maybe Bool)
describeSnapshots_showNodeGroupConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Bool
showNodeGroupConfig :: Maybe Bool
$sel:showNodeGroupConfig:DescribeSnapshots' :: DescribeSnapshots -> Maybe Bool
showNodeGroupConfig} -> Maybe Bool
showNodeGroupConfig) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Bool
a -> DescribeSnapshots
s {$sel:showNodeGroupConfig:DescribeSnapshots' :: Maybe Bool
showNodeGroupConfig = Maybe Bool
a} :: DescribeSnapshots)

-- | A user-supplied name of the snapshot. If this parameter is specified,
-- only this snapshot are described.
describeSnapshots_snapshotName :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Text)
describeSnapshots_snapshotName :: Lens' DescribeSnapshots (Maybe Text)
describeSnapshots_snapshotName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Text
snapshotName :: Maybe Text
$sel:snapshotName:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
snapshotName} -> Maybe Text
snapshotName) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Text
a -> DescribeSnapshots
s {$sel:snapshotName:DescribeSnapshots' :: Maybe Text
snapshotName = Maybe Text
a} :: DescribeSnapshots)

-- | If set to @system@, the output shows snapshots that were automatically
-- created by ElastiCache. If set to @user@ the output shows snapshots that
-- were manually created. If omitted, the output shows both automatically
-- and manually created snapshots.
describeSnapshots_snapshotSource :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Text)
describeSnapshots_snapshotSource :: Lens' DescribeSnapshots (Maybe Text)
describeSnapshots_snapshotSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Text
snapshotSource :: Maybe Text
$sel:snapshotSource:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
snapshotSource} -> Maybe Text
snapshotSource) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Text
a -> DescribeSnapshots
s {$sel:snapshotSource:DescribeSnapshots' :: Maybe Text
snapshotSource = Maybe Text
a} :: DescribeSnapshots)

instance Core.AWSPager DescribeSnapshots where
  page :: DescribeSnapshots
-> AWSResponse DescribeSnapshots -> Maybe DescribeSnapshots
page DescribeSnapshots
rq AWSResponse DescribeSnapshots
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSnapshots
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeSnapshotsResponse (Maybe Text)
describeSnapshotsResponse_marker
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSnapshots
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeSnapshotsResponse (Maybe [Snapshot])
describeSnapshotsResponse_snapshots
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeSnapshots
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeSnapshots (Maybe Text)
describeSnapshots_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeSnapshots
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeSnapshotsResponse (Maybe Text)
describeSnapshotsResponse_marker
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeSnapshots where
  type
    AWSResponse DescribeSnapshots =
      DescribeSnapshotsResponse
  request :: (Service -> Service)
-> DescribeSnapshots -> Request DescribeSnapshots
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeSnapshots
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSnapshots)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeSnapshotsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Maybe [Snapshot] -> Int -> DescribeSnapshotsResponse
DescribeSnapshotsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Marker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Snapshots"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"Snapshot")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeSnapshots where
  hashWithSalt :: Int -> DescribeSnapshots -> Int
hashWithSalt Int
_salt DescribeSnapshots' {Maybe Bool
Maybe Int
Maybe Text
snapshotSource :: Maybe Text
snapshotName :: Maybe Text
showNodeGroupConfig :: Maybe Bool
replicationGroupId :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
cacheClusterId :: Maybe Text
$sel:snapshotSource:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:snapshotName:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:showNodeGroupConfig:DescribeSnapshots' :: DescribeSnapshots -> Maybe Bool
$sel:replicationGroupId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:maxRecords:DescribeSnapshots' :: DescribeSnapshots -> Maybe Int
$sel:marker:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:cacheClusterId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cacheClusterId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxRecords
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
replicationGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
showNodeGroupConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotSource

instance Prelude.NFData DescribeSnapshots where
  rnf :: DescribeSnapshots -> ()
rnf DescribeSnapshots' {Maybe Bool
Maybe Int
Maybe Text
snapshotSource :: Maybe Text
snapshotName :: Maybe Text
showNodeGroupConfig :: Maybe Bool
replicationGroupId :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
cacheClusterId :: Maybe Text
$sel:snapshotSource:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:snapshotName:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:showNodeGroupConfig:DescribeSnapshots' :: DescribeSnapshots -> Maybe Bool
$sel:replicationGroupId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:maxRecords:DescribeSnapshots' :: DescribeSnapshots -> Maybe Int
$sel:marker:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:cacheClusterId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cacheClusterId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxRecords
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
replicationGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
showNodeGroupConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotSource

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

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

instance Data.ToQuery DescribeSnapshots where
  toQuery :: DescribeSnapshots -> QueryString
toQuery DescribeSnapshots' {Maybe Bool
Maybe Int
Maybe Text
snapshotSource :: Maybe Text
snapshotName :: Maybe Text
showNodeGroupConfig :: Maybe Bool
replicationGroupId :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
cacheClusterId :: Maybe Text
$sel:snapshotSource:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:snapshotName:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:showNodeGroupConfig:DescribeSnapshots' :: DescribeSnapshots -> Maybe Bool
$sel:replicationGroupId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:maxRecords:DescribeSnapshots' :: DescribeSnapshots -> Maybe Int
$sel:marker:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:cacheClusterId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeSnapshots" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"CacheClusterId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
cacheClusterId,
        ByteString
"Marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
        ByteString
"MaxRecords" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxRecords,
        ByteString
"ReplicationGroupId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
replicationGroupId,
        ByteString
"ShowNodeGroupConfig" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
showNodeGroupConfig,
        ByteString
"SnapshotName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
snapshotName,
        ByteString
"SnapshotSource" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
snapshotSource
      ]

-- | Represents the output of a @DescribeSnapshots@ operation.
--
-- /See:/ 'newDescribeSnapshotsResponse' smart constructor.
data DescribeSnapshotsResponse = DescribeSnapshotsResponse'
  { -- | 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@.
    DescribeSnapshotsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of snapshots. Each item in the list contains detailed information
    -- about one snapshot.
    DescribeSnapshotsResponse -> Maybe [Snapshot]
snapshots :: Prelude.Maybe [Snapshot],
    -- | The response's http status code.
    DescribeSnapshotsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool
$c/= :: DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool
== :: DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool
$c== :: DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeSnapshotsResponse]
ReadPrec DescribeSnapshotsResponse
Int -> ReadS DescribeSnapshotsResponse
ReadS [DescribeSnapshotsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSnapshotsResponse]
$creadListPrec :: ReadPrec [DescribeSnapshotsResponse]
readPrec :: ReadPrec DescribeSnapshotsResponse
$creadPrec :: ReadPrec DescribeSnapshotsResponse
readList :: ReadS [DescribeSnapshotsResponse]
$creadList :: ReadS [DescribeSnapshotsResponse]
readsPrec :: Int -> ReadS DescribeSnapshotsResponse
$creadsPrec :: Int -> ReadS DescribeSnapshotsResponse
Prelude.Read, Int -> DescribeSnapshotsResponse -> ShowS
[DescribeSnapshotsResponse] -> ShowS
DescribeSnapshotsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSnapshotsResponse] -> ShowS
$cshowList :: [DescribeSnapshotsResponse] -> ShowS
show :: DescribeSnapshotsResponse -> String
$cshow :: DescribeSnapshotsResponse -> String
showsPrec :: Int -> DescribeSnapshotsResponse -> ShowS
$cshowsPrec :: Int -> DescribeSnapshotsResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeSnapshotsResponse x -> DescribeSnapshotsResponse
forall x.
DescribeSnapshotsResponse -> Rep DescribeSnapshotsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSnapshotsResponse x -> DescribeSnapshotsResponse
$cfrom :: forall x.
DescribeSnapshotsResponse -> Rep DescribeSnapshotsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSnapshotsResponse' 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:
--
-- 'marker', 'describeSnapshotsResponse_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@.
--
-- 'snapshots', 'describeSnapshotsResponse_snapshots' - A list of snapshots. Each item in the list contains detailed information
-- about one snapshot.
--
-- 'httpStatus', 'describeSnapshotsResponse_httpStatus' - The response's http status code.
newDescribeSnapshotsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSnapshotsResponse
newDescribeSnapshotsResponse :: Int -> DescribeSnapshotsResponse
newDescribeSnapshotsResponse Int
pHttpStatus_ =
  DescribeSnapshotsResponse'
    { $sel:marker:DescribeSnapshotsResponse' :: Maybe Text
marker =
        forall a. Maybe a
Prelude.Nothing,
      $sel:snapshots:DescribeSnapshotsResponse' :: Maybe [Snapshot]
snapshots = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSnapshotsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | A list of snapshots. Each item in the list contains detailed information
-- about one snapshot.
describeSnapshotsResponse_snapshots :: Lens.Lens' DescribeSnapshotsResponse (Prelude.Maybe [Snapshot])
describeSnapshotsResponse_snapshots :: Lens' DescribeSnapshotsResponse (Maybe [Snapshot])
describeSnapshotsResponse_snapshots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshotsResponse' {Maybe [Snapshot]
snapshots :: Maybe [Snapshot]
$sel:snapshots:DescribeSnapshotsResponse' :: DescribeSnapshotsResponse -> Maybe [Snapshot]
snapshots} -> Maybe [Snapshot]
snapshots) (\s :: DescribeSnapshotsResponse
s@DescribeSnapshotsResponse' {} Maybe [Snapshot]
a -> DescribeSnapshotsResponse
s {$sel:snapshots:DescribeSnapshotsResponse' :: Maybe [Snapshot]
snapshots = Maybe [Snapshot]
a} :: DescribeSnapshotsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DescribeSnapshotsResponse where
  rnf :: DescribeSnapshotsResponse -> ()
rnf DescribeSnapshotsResponse' {Int
Maybe [Snapshot]
Maybe Text
httpStatus :: Int
snapshots :: Maybe [Snapshot]
marker :: Maybe Text
$sel:httpStatus:DescribeSnapshotsResponse' :: DescribeSnapshotsResponse -> Int
$sel:snapshots:DescribeSnapshotsResponse' :: DescribeSnapshotsResponse -> Maybe [Snapshot]
$sel:marker:DescribeSnapshotsResponse' :: DescribeSnapshotsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Snapshot]
snapshots
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus