{-# 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.RedshiftServerLess.ListSnapshots
-- 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 a list of snapshots.
--
-- This operation returns paginated results.
module Amazonka.RedshiftServerLess.ListSnapshots
  ( -- * Creating a Request
    ListSnapshots (..),
    newListSnapshots,

    -- * Request Lenses
    listSnapshots_endTime,
    listSnapshots_maxResults,
    listSnapshots_namespaceArn,
    listSnapshots_namespaceName,
    listSnapshots_nextToken,
    listSnapshots_ownerAccount,
    listSnapshots_startTime,

    -- * Destructuring the Response
    ListSnapshotsResponse (..),
    newListSnapshotsResponse,

    -- * Response Lenses
    listSnapshotsResponse_nextToken,
    listSnapshotsResponse_snapshots,
    listSnapshotsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListSnapshots' smart constructor.
data ListSnapshots = ListSnapshots'
  { -- | The timestamp showing when the snapshot creation finished.
    ListSnapshots -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | An optional parameter that specifies the maximum number of results to
    -- return. You can use @nextToken@ to display the next page of results.
    ListSnapshots -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the namespace from which to list all
    -- snapshots.
    ListSnapshots -> Maybe Text
namespaceArn :: Prelude.Maybe Prelude.Text,
    -- | The namespace from which to list all snapshots.
    ListSnapshots -> Maybe Text
namespaceName :: Prelude.Maybe Prelude.Text,
    -- | If @nextToken@ is returned, there are more results available. The value
    -- of @nextToken@ is a unique pagination token for each page. Make the call
    -- again using the returned token to retrieve the next page.
    ListSnapshots -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The owner Amazon Web Services account of the snapshot.
    ListSnapshots -> Maybe Text
ownerAccount :: Prelude.Maybe Prelude.Text,
    -- | The time when the creation of the snapshot was initiated.
    ListSnapshots -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX
  }
  deriving (ListSnapshots -> ListSnapshots -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSnapshots -> ListSnapshots -> Bool
$c/= :: ListSnapshots -> ListSnapshots -> Bool
== :: ListSnapshots -> ListSnapshots -> Bool
$c== :: ListSnapshots -> ListSnapshots -> Bool
Prelude.Eq, ReadPrec [ListSnapshots]
ReadPrec ListSnapshots
Int -> ReadS ListSnapshots
ReadS [ListSnapshots]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSnapshots]
$creadListPrec :: ReadPrec [ListSnapshots]
readPrec :: ReadPrec ListSnapshots
$creadPrec :: ReadPrec ListSnapshots
readList :: ReadS [ListSnapshots]
$creadList :: ReadS [ListSnapshots]
readsPrec :: Int -> ReadS ListSnapshots
$creadsPrec :: Int -> ReadS ListSnapshots
Prelude.Read, Int -> ListSnapshots -> ShowS
[ListSnapshots] -> ShowS
ListSnapshots -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSnapshots] -> ShowS
$cshowList :: [ListSnapshots] -> ShowS
show :: ListSnapshots -> String
$cshow :: ListSnapshots -> String
showsPrec :: Int -> ListSnapshots -> ShowS
$cshowsPrec :: Int -> ListSnapshots -> ShowS
Prelude.Show, forall x. Rep ListSnapshots x -> ListSnapshots
forall x. ListSnapshots -> Rep ListSnapshots x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSnapshots x -> ListSnapshots
$cfrom :: forall x. ListSnapshots -> Rep ListSnapshots x
Prelude.Generic)

-- |
-- Create a value of 'ListSnapshots' 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:
--
-- 'endTime', 'listSnapshots_endTime' - The timestamp showing when the snapshot creation finished.
--
-- 'maxResults', 'listSnapshots_maxResults' - An optional parameter that specifies the maximum number of results to
-- return. You can use @nextToken@ to display the next page of results.
--
-- 'namespaceArn', 'listSnapshots_namespaceArn' - The Amazon Resource Name (ARN) of the namespace from which to list all
-- snapshots.
--
-- 'namespaceName', 'listSnapshots_namespaceName' - The namespace from which to list all snapshots.
--
-- 'nextToken', 'listSnapshots_nextToken' - If @nextToken@ is returned, there are more results available. The value
-- of @nextToken@ is a unique pagination token for each page. Make the call
-- again using the returned token to retrieve the next page.
--
-- 'ownerAccount', 'listSnapshots_ownerAccount' - The owner Amazon Web Services account of the snapshot.
--
-- 'startTime', 'listSnapshots_startTime' - The time when the creation of the snapshot was initiated.
newListSnapshots ::
  ListSnapshots
newListSnapshots :: ListSnapshots
newListSnapshots =
  ListSnapshots'
    { $sel:endTime:ListSnapshots' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListSnapshots' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:namespaceArn:ListSnapshots' :: Maybe Text
namespaceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:namespaceName:ListSnapshots' :: Maybe Text
namespaceName = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListSnapshots' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:ownerAccount:ListSnapshots' :: Maybe Text
ownerAccount = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ListSnapshots' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp showing when the snapshot creation finished.
listSnapshots_endTime :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.UTCTime)
listSnapshots_endTime :: Lens' ListSnapshots (Maybe UTCTime)
listSnapshots_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe POSIX
a -> ListSnapshots
s {$sel:endTime:ListSnapshots' :: Maybe POSIX
endTime = Maybe POSIX
a} :: ListSnapshots) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | An optional parameter that specifies the maximum number of results to
-- return. You can use @nextToken@ to display the next page of results.
listSnapshots_maxResults :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.Natural)
listSnapshots_maxResults :: Lens' ListSnapshots (Maybe Natural)
listSnapshots_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe Natural
a -> ListSnapshots
s {$sel:maxResults:ListSnapshots' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSnapshots)

-- | The Amazon Resource Name (ARN) of the namespace from which to list all
-- snapshots.
listSnapshots_namespaceArn :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.Text)
listSnapshots_namespaceArn :: Lens' ListSnapshots (Maybe Text)
listSnapshots_namespaceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe Text
namespaceArn :: Maybe Text
$sel:namespaceArn:ListSnapshots' :: ListSnapshots -> Maybe Text
namespaceArn} -> Maybe Text
namespaceArn) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe Text
a -> ListSnapshots
s {$sel:namespaceArn:ListSnapshots' :: Maybe Text
namespaceArn = Maybe Text
a} :: ListSnapshots)

-- | The namespace from which to list all snapshots.
listSnapshots_namespaceName :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.Text)
listSnapshots_namespaceName :: Lens' ListSnapshots (Maybe Text)
listSnapshots_namespaceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe Text
namespaceName :: Maybe Text
$sel:namespaceName:ListSnapshots' :: ListSnapshots -> Maybe Text
namespaceName} -> Maybe Text
namespaceName) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe Text
a -> ListSnapshots
s {$sel:namespaceName:ListSnapshots' :: Maybe Text
namespaceName = Maybe Text
a} :: ListSnapshots)

-- | If @nextToken@ is returned, there are more results available. The value
-- of @nextToken@ is a unique pagination token for each page. Make the call
-- again using the returned token to retrieve the next page.
listSnapshots_nextToken :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.Text)
listSnapshots_nextToken :: Lens' ListSnapshots (Maybe Text)
listSnapshots_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe Text
a -> ListSnapshots
s {$sel:nextToken:ListSnapshots' :: Maybe Text
nextToken = Maybe Text
a} :: ListSnapshots)

-- | The owner Amazon Web Services account of the snapshot.
listSnapshots_ownerAccount :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.Text)
listSnapshots_ownerAccount :: Lens' ListSnapshots (Maybe Text)
listSnapshots_ownerAccount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe Text
ownerAccount :: Maybe Text
$sel:ownerAccount:ListSnapshots' :: ListSnapshots -> Maybe Text
ownerAccount} -> Maybe Text
ownerAccount) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe Text
a -> ListSnapshots
s {$sel:ownerAccount:ListSnapshots' :: Maybe Text
ownerAccount = Maybe Text
a} :: ListSnapshots)

-- | The time when the creation of the snapshot was initiated.
listSnapshots_startTime :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.UTCTime)
listSnapshots_startTime :: Lens' ListSnapshots (Maybe UTCTime)
listSnapshots_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe POSIX
a -> ListSnapshots
s {$sel:startTime:ListSnapshots' :: Maybe POSIX
startTime = Maybe POSIX
a} :: ListSnapshots) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Core.AWSPager ListSnapshots where
  page :: ListSnapshots -> AWSResponse ListSnapshots -> Maybe ListSnapshots
page ListSnapshots
rq AWSResponse ListSnapshots
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSnapshots
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSnapshotsResponse (Maybe Text)
listSnapshotsResponse_nextToken
            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 ListSnapshots
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSnapshotsResponse (Maybe [Snapshot])
listSnapshotsResponse_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.$ ListSnapshots
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListSnapshots (Maybe Text)
listSnapshots_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSnapshots
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSnapshotsResponse (Maybe Text)
listSnapshotsResponse_nextToken
          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 ListSnapshots where
  type
    AWSResponse ListSnapshots =
      ListSnapshotsResponse
  request :: (Service -> Service) -> ListSnapshots -> Request ListSnapshots
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListSnapshots
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSnapshots)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe [Snapshot] -> Int -> ListSnapshotsResponse
ListSnapshotsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"snapshots" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 ListSnapshots where
  hashWithSalt :: Int -> ListSnapshots -> Int
hashWithSalt Int
_salt ListSnapshots' {Maybe Natural
Maybe Text
Maybe POSIX
startTime :: Maybe POSIX
ownerAccount :: Maybe Text
nextToken :: Maybe Text
namespaceName :: Maybe Text
namespaceArn :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
$sel:startTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
$sel:ownerAccount:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:namespaceName:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:namespaceArn:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
$sel:endTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
namespaceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
namespaceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ownerAccount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime

instance Prelude.NFData ListSnapshots where
  rnf :: ListSnapshots -> ()
rnf ListSnapshots' {Maybe Natural
Maybe Text
Maybe POSIX
startTime :: Maybe POSIX
ownerAccount :: Maybe Text
nextToken :: Maybe Text
namespaceName :: Maybe Text
namespaceArn :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
$sel:startTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
$sel:ownerAccount:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:namespaceName:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:namespaceArn:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
$sel:endTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
namespaceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
namespaceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ownerAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime

instance Data.ToHeaders ListSnapshots where
  toHeaders :: ListSnapshots -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"RedshiftServerless.ListSnapshots" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListSnapshots where
  toJSON :: ListSnapshots -> Value
toJSON ListSnapshots' {Maybe Natural
Maybe Text
Maybe POSIX
startTime :: Maybe POSIX
ownerAccount :: Maybe Text
nextToken :: Maybe Text
namespaceName :: Maybe Text
namespaceArn :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
$sel:startTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
$sel:ownerAccount:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:namespaceName:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:namespaceArn:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
$sel:endTime:ListSnapshots' :: ListSnapshots -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"endTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
endTime,
            (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"namespaceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
namespaceArn,
            (Key
"namespaceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
namespaceName,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"ownerAccount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ownerAccount,
            (Key
"startTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startTime
          ]
      )

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

instance Data.ToQuery ListSnapshots where
  toQuery :: ListSnapshots -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListSnapshotsResponse' smart constructor.
data ListSnapshotsResponse = ListSnapshotsResponse'
  { -- | If @nextToken@ is returned, there are more results available. The value
    -- of @nextToken@ is a unique pagination token for each page. Make the call
    -- again using the returned token to retrieve the next page.
    ListSnapshotsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | All of the returned snapshot objects.
    ListSnapshotsResponse -> Maybe [Snapshot]
snapshots :: Prelude.Maybe [Snapshot],
    -- | The response's http status code.
    ListSnapshotsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
$c/= :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
== :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
$c== :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
Prelude.Eq, ReadPrec [ListSnapshotsResponse]
ReadPrec ListSnapshotsResponse
Int -> ReadS ListSnapshotsResponse
ReadS [ListSnapshotsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSnapshotsResponse]
$creadListPrec :: ReadPrec [ListSnapshotsResponse]
readPrec :: ReadPrec ListSnapshotsResponse
$creadPrec :: ReadPrec ListSnapshotsResponse
readList :: ReadS [ListSnapshotsResponse]
$creadList :: ReadS [ListSnapshotsResponse]
readsPrec :: Int -> ReadS ListSnapshotsResponse
$creadsPrec :: Int -> ReadS ListSnapshotsResponse
Prelude.Read, Int -> ListSnapshotsResponse -> ShowS
[ListSnapshotsResponse] -> ShowS
ListSnapshotsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSnapshotsResponse] -> ShowS
$cshowList :: [ListSnapshotsResponse] -> ShowS
show :: ListSnapshotsResponse -> String
$cshow :: ListSnapshotsResponse -> String
showsPrec :: Int -> ListSnapshotsResponse -> ShowS
$cshowsPrec :: Int -> ListSnapshotsResponse -> ShowS
Prelude.Show, forall x. Rep ListSnapshotsResponse x -> ListSnapshotsResponse
forall x. ListSnapshotsResponse -> Rep ListSnapshotsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSnapshotsResponse x -> ListSnapshotsResponse
$cfrom :: forall x. ListSnapshotsResponse -> Rep ListSnapshotsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSnapshotsResponse' 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:
--
-- 'nextToken', 'listSnapshotsResponse_nextToken' - If @nextToken@ is returned, there are more results available. The value
-- of @nextToken@ is a unique pagination token for each page. Make the call
-- again using the returned token to retrieve the next page.
--
-- 'snapshots', 'listSnapshotsResponse_snapshots' - All of the returned snapshot objects.
--
-- 'httpStatus', 'listSnapshotsResponse_httpStatus' - The response's http status code.
newListSnapshotsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSnapshotsResponse
newListSnapshotsResponse :: Int -> ListSnapshotsResponse
newListSnapshotsResponse Int
pHttpStatus_ =
  ListSnapshotsResponse'
    { $sel:nextToken:ListSnapshotsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshots:ListSnapshotsResponse' :: Maybe [Snapshot]
snapshots = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSnapshotsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If @nextToken@ is returned, there are more results available. The value
-- of @nextToken@ is a unique pagination token for each page. Make the call
-- again using the returned token to retrieve the next page.
listSnapshotsResponse_nextToken :: Lens.Lens' ListSnapshotsResponse (Prelude.Maybe Prelude.Text)
listSnapshotsResponse_nextToken :: Lens' ListSnapshotsResponse (Maybe Text)
listSnapshotsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshotsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSnapshotsResponse
s@ListSnapshotsResponse' {} Maybe Text
a -> ListSnapshotsResponse
s {$sel:nextToken:ListSnapshotsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSnapshotsResponse)

-- | All of the returned snapshot objects.
listSnapshotsResponse_snapshots :: Lens.Lens' ListSnapshotsResponse (Prelude.Maybe [Snapshot])
listSnapshotsResponse_snapshots :: Lens' ListSnapshotsResponse (Maybe [Snapshot])
listSnapshotsResponse_snapshots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshotsResponse' {Maybe [Snapshot]
snapshots :: Maybe [Snapshot]
$sel:snapshots:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe [Snapshot]
snapshots} -> Maybe [Snapshot]
snapshots) (\s :: ListSnapshotsResponse
s@ListSnapshotsResponse' {} Maybe [Snapshot]
a -> ListSnapshotsResponse
s {$sel:snapshots:ListSnapshotsResponse' :: Maybe [Snapshot]
snapshots = Maybe [Snapshot]
a} :: ListSnapshotsResponse) 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.
listSnapshotsResponse_httpStatus :: Lens.Lens' ListSnapshotsResponse Prelude.Int
listSnapshotsResponse_httpStatus :: Lens' ListSnapshotsResponse Int
listSnapshotsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshotsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSnapshotsResponse' :: ListSnapshotsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSnapshotsResponse
s@ListSnapshotsResponse' {} Int
a -> ListSnapshotsResponse
s {$sel:httpStatus:ListSnapshotsResponse' :: Int
httpStatus = Int
a} :: ListSnapshotsResponse)

instance Prelude.NFData ListSnapshotsResponse where
  rnf :: ListSnapshotsResponse -> ()
rnf ListSnapshotsResponse' {Int
Maybe [Snapshot]
Maybe Text
httpStatus :: Int
snapshots :: Maybe [Snapshot]
nextToken :: Maybe Text
$sel:httpStatus:ListSnapshotsResponse' :: ListSnapshotsResponse -> Int
$sel:snapshots:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe [Snapshot]
$sel:nextToken:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      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