{-# 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.DirectoryService.DescribeSnapshots
-- 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)
--
-- Obtains information about the directory snapshots that belong to this
-- account.
--
-- This operation supports pagination with the use of the /NextToken/
-- request and response parameters. If more results are available, the
-- /DescribeSnapshots.NextToken/ member contains a token that you pass in
-- the next call to DescribeSnapshots to retrieve the next set of items.
--
-- You can also specify a maximum number of return results with the /Limit/
-- parameter.
--
-- This operation returns paginated results.
module Amazonka.DirectoryService.DescribeSnapshots
  ( -- * Creating a Request
    DescribeSnapshots (..),
    newDescribeSnapshots,

    -- * Request Lenses
    describeSnapshots_directoryId,
    describeSnapshots_nextToken,
    describeSnapshots_snapshotIds,
    describeSnapshots_limit,

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

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

import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.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

-- | Contains the inputs for the DescribeSnapshots operation.
--
-- /See:/ 'newDescribeSnapshots' smart constructor.
data DescribeSnapshots = DescribeSnapshots'
  { -- | The identifier of the directory for which to retrieve snapshot
    -- information.
    DescribeSnapshots -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
    -- | The /DescribeSnapshotsResult.NextToken/ value from a previous call to
    -- DescribeSnapshots. Pass null if this is the first call.
    DescribeSnapshots -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of identifiers of the snapshots to obtain the information for. If
    -- this member is null or empty, all snapshots are returned using the
    -- /Limit/ and /NextToken/ members.
    DescribeSnapshots -> Maybe [Text]
snapshotIds :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of objects to return.
    DescribeSnapshots -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeSnapshots -> DescribeSnapshots -> Bool
(DescribeSnapshots -> DescribeSnapshots -> Bool)
-> (DescribeSnapshots -> DescribeSnapshots -> Bool)
-> Eq DescribeSnapshots
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]
(Int -> ReadS DescribeSnapshots)
-> ReadS [DescribeSnapshots]
-> ReadPrec DescribeSnapshots
-> ReadPrec [DescribeSnapshots]
-> Read 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
(Int -> DescribeSnapshots -> ShowS)
-> (DescribeSnapshots -> String)
-> ([DescribeSnapshots] -> ShowS)
-> Show DescribeSnapshots
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. DescribeSnapshots -> Rep DescribeSnapshots x)
-> (forall x. Rep DescribeSnapshots x -> DescribeSnapshots)
-> Generic DescribeSnapshots
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:
--
-- 'directoryId', 'describeSnapshots_directoryId' - The identifier of the directory for which to retrieve snapshot
-- information.
--
-- 'nextToken', 'describeSnapshots_nextToken' - The /DescribeSnapshotsResult.NextToken/ value from a previous call to
-- DescribeSnapshots. Pass null if this is the first call.
--
-- 'snapshotIds', 'describeSnapshots_snapshotIds' - A list of identifiers of the snapshots to obtain the information for. If
-- this member is null or empty, all snapshots are returned using the
-- /Limit/ and /NextToken/ members.
--
-- 'limit', 'describeSnapshots_limit' - The maximum number of objects to return.
newDescribeSnapshots ::
  DescribeSnapshots
newDescribeSnapshots :: DescribeSnapshots
newDescribeSnapshots =
  DescribeSnapshots' :: Maybe Text
-> Maybe Text -> Maybe [Text] -> Maybe Natural -> DescribeSnapshots
DescribeSnapshots'
    { $sel:directoryId:DescribeSnapshots' :: Maybe Text
directoryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSnapshots' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotIds:DescribeSnapshots' :: Maybe [Text]
snapshotIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeSnapshots' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the directory for which to retrieve snapshot
-- information.
describeSnapshots_directoryId :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Text)
describeSnapshots_directoryId :: (Maybe Text -> f (Maybe Text))
-> DescribeSnapshots -> f DescribeSnapshots
describeSnapshots_directoryId = (DescribeSnapshots -> Maybe Text)
-> (DescribeSnapshots -> Maybe Text -> DescribeSnapshots)
-> Lens
     DescribeSnapshots DescribeSnapshots (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Text
a -> DescribeSnapshots
s {$sel:directoryId:DescribeSnapshots' :: Maybe Text
directoryId = Maybe Text
a} :: DescribeSnapshots)

-- | The /DescribeSnapshotsResult.NextToken/ value from a previous call to
-- DescribeSnapshots. Pass null if this is the first call.
describeSnapshots_nextToken :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Text)
describeSnapshots_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSnapshots -> f DescribeSnapshots
describeSnapshots_nextToken = (DescribeSnapshots -> Maybe Text)
-> (DescribeSnapshots -> Maybe Text -> DescribeSnapshots)
-> Lens
     DescribeSnapshots DescribeSnapshots (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Text
a -> DescribeSnapshots
s {$sel:nextToken:DescribeSnapshots' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSnapshots)

-- | A list of identifiers of the snapshots to obtain the information for. If
-- this member is null or empty, all snapshots are returned using the
-- /Limit/ and /NextToken/ members.
describeSnapshots_snapshotIds :: Lens.Lens' DescribeSnapshots (Prelude.Maybe [Prelude.Text])
describeSnapshots_snapshotIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeSnapshots -> f DescribeSnapshots
describeSnapshots_snapshotIds = (DescribeSnapshots -> Maybe [Text])
-> (DescribeSnapshots -> Maybe [Text] -> DescribeSnapshots)
-> Lens
     DescribeSnapshots DescribeSnapshots (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe [Text]
snapshotIds :: Maybe [Text]
$sel:snapshotIds:DescribeSnapshots' :: DescribeSnapshots -> Maybe [Text]
snapshotIds} -> Maybe [Text]
snapshotIds) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe [Text]
a -> DescribeSnapshots
s {$sel:snapshotIds:DescribeSnapshots' :: Maybe [Text]
snapshotIds = Maybe [Text]
a} :: DescribeSnapshots) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeSnapshots -> f DescribeSnapshots)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeSnapshots
-> f DescribeSnapshots
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of objects to return.
describeSnapshots_limit :: Lens.Lens' DescribeSnapshots (Prelude.Maybe Prelude.Natural)
describeSnapshots_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeSnapshots -> f DescribeSnapshots
describeSnapshots_limit = (DescribeSnapshots -> Maybe Natural)
-> (DescribeSnapshots -> Maybe Natural -> DescribeSnapshots)
-> Lens
     DescribeSnapshots DescribeSnapshots (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshots' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeSnapshots' :: DescribeSnapshots -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeSnapshots
s@DescribeSnapshots' {} Maybe Natural
a -> DescribeSnapshots
s {$sel:limit:DescribeSnapshots' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeSnapshots)

instance Core.AWSPager DescribeSnapshots where
  page :: DescribeSnapshots
-> AWSResponse DescribeSnapshots -> Maybe DescribeSnapshots
page DescribeSnapshots
rq AWSResponse DescribeSnapshots
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSnapshots
DescribeSnapshotsResponse
rs
            DescribeSnapshotsResponse
-> Getting (First Text) DescribeSnapshotsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeSnapshotsResponse
-> Const (First Text) DescribeSnapshotsResponse
Lens' DescribeSnapshotsResponse (Maybe Text)
describeSnapshotsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeSnapshotsResponse
 -> Const (First Text) DescribeSnapshotsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeSnapshotsResponse 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 DescribeSnapshots
forall a. Maybe a
Prelude.Nothing
    | Maybe [Snapshot] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSnapshots
DescribeSnapshotsResponse
rs
            DescribeSnapshotsResponse
-> Getting (First [Snapshot]) DescribeSnapshotsResponse [Snapshot]
-> Maybe [Snapshot]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Snapshot] -> Const (First [Snapshot]) (Maybe [Snapshot]))
-> DescribeSnapshotsResponse
-> Const (First [Snapshot]) DescribeSnapshotsResponse
Lens' DescribeSnapshotsResponse (Maybe [Snapshot])
describeSnapshotsResponse_snapshots
              ((Maybe [Snapshot] -> Const (First [Snapshot]) (Maybe [Snapshot]))
 -> DescribeSnapshotsResponse
 -> Const (First [Snapshot]) DescribeSnapshotsResponse)
-> (([Snapshot] -> Const (First [Snapshot]) [Snapshot])
    -> Maybe [Snapshot] -> Const (First [Snapshot]) (Maybe [Snapshot]))
-> Getting (First [Snapshot]) DescribeSnapshotsResponse [Snapshot]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Snapshot] -> Const (First [Snapshot]) [Snapshot])
-> Maybe [Snapshot] -> Const (First [Snapshot]) (Maybe [Snapshot])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeSnapshots
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeSnapshots -> Maybe DescribeSnapshots
forall a. a -> Maybe a
Prelude.Just (DescribeSnapshots -> Maybe DescribeSnapshots)
-> DescribeSnapshots -> Maybe DescribeSnapshots
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeSnapshots
rq
          DescribeSnapshots
-> (DescribeSnapshots -> DescribeSnapshots) -> DescribeSnapshots
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeSnapshots -> Identity DescribeSnapshots
Lens DescribeSnapshots DescribeSnapshots (Maybe Text) (Maybe Text)
describeSnapshots_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeSnapshots -> Identity DescribeSnapshots)
-> Maybe Text -> DescribeSnapshots -> DescribeSnapshots
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeSnapshots
DescribeSnapshotsResponse
rs
          DescribeSnapshotsResponse
-> Getting (First Text) DescribeSnapshotsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeSnapshotsResponse
-> Const (First Text) DescribeSnapshotsResponse
Lens' DescribeSnapshotsResponse (Maybe Text)
describeSnapshotsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeSnapshotsResponse
 -> Const (First Text) DescribeSnapshotsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeSnapshotsResponse 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 DescribeSnapshots where
  type
    AWSResponse DescribeSnapshots =
      DescribeSnapshotsResponse
  request :: DescribeSnapshots -> Request DescribeSnapshots
request = Service -> DescribeSnapshots -> Request DescribeSnapshots
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeSnapshots
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSnapshots)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeSnapshots))
-> Logger
-> Service
-> Proxy DescribeSnapshots
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSnapshots)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe [Snapshot] -> Int -> DescribeSnapshotsResponse
DescribeSnapshotsResponse'
            (Maybe Text
 -> Maybe [Snapshot] -> Int -> DescribeSnapshotsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [Snapshot] -> Int -> DescribeSnapshotsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String (Maybe [Snapshot] -> Int -> DescribeSnapshotsResponse)
-> Either String (Maybe [Snapshot])
-> Either String (Int -> DescribeSnapshotsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Snapshot]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Snapshots" Either String (Maybe (Maybe [Snapshot]))
-> Maybe [Snapshot] -> Either String (Maybe [Snapshot])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Snapshot]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> DescribeSnapshotsResponse)
-> Either String Int -> Either String DescribeSnapshotsResponse
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 DescribeSnapshots

instance Prelude.NFData DescribeSnapshots

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

instance Core.ToJSON DescribeSnapshots where
  toJSON :: DescribeSnapshots -> Value
toJSON DescribeSnapshots' {Maybe Natural
Maybe [Text]
Maybe Text
limit :: Maybe Natural
snapshotIds :: Maybe [Text]
nextToken :: Maybe Text
directoryId :: Maybe Text
$sel:limit:DescribeSnapshots' :: DescribeSnapshots -> Maybe Natural
$sel:snapshotIds:DescribeSnapshots' :: DescribeSnapshots -> Maybe [Text]
$sel:nextToken:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
$sel:directoryId:DescribeSnapshots' :: DescribeSnapshots -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
directoryId,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"SnapshotIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
snapshotIds,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit
          ]
      )

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

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

-- | Contains the results of the DescribeSnapshots operation.
--
-- /See:/ 'newDescribeSnapshotsResponse' smart constructor.
data DescribeSnapshotsResponse = DescribeSnapshotsResponse'
  { -- | If not null, more results are available. Pass this value in the
    -- /NextToken/ member of a subsequent call to DescribeSnapshots.
    DescribeSnapshotsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of Snapshot objects that were retrieved.
    --
    -- It is possible that this list contains less than the number of items
    -- specified in the /Limit/ member of the request. This occurs if there are
    -- less than the requested number of items left to retrieve, or if the
    -- limitations of the operation have been exceeded.
    DescribeSnapshotsResponse -> Maybe [Snapshot]
snapshots :: Prelude.Maybe [Snapshot],
    -- | The response's http status code.
    DescribeSnapshotsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool
(DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool)
-> (DescribeSnapshotsResponse -> DescribeSnapshotsResponse -> Bool)
-> Eq DescribeSnapshotsResponse
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]
(Int -> ReadS DescribeSnapshotsResponse)
-> ReadS [DescribeSnapshotsResponse]
-> ReadPrec DescribeSnapshotsResponse
-> ReadPrec [DescribeSnapshotsResponse]
-> Read 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
(Int -> DescribeSnapshotsResponse -> ShowS)
-> (DescribeSnapshotsResponse -> String)
-> ([DescribeSnapshotsResponse] -> ShowS)
-> Show DescribeSnapshotsResponse
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.
 DescribeSnapshotsResponse -> Rep DescribeSnapshotsResponse x)
-> (forall x.
    Rep DescribeSnapshotsResponse x -> DescribeSnapshotsResponse)
-> Generic DescribeSnapshotsResponse
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:
--
-- 'nextToken', 'describeSnapshotsResponse_nextToken' - If not null, more results are available. Pass this value in the
-- /NextToken/ member of a subsequent call to DescribeSnapshots.
--
-- 'snapshots', 'describeSnapshotsResponse_snapshots' - The list of Snapshot objects that were retrieved.
--
-- It is possible that this list contains less than the number of items
-- specified in the /Limit/ member of the request. This occurs if there are
-- less than the requested number of items left to retrieve, or if the
-- limitations of the operation have been exceeded.
--
-- 'httpStatus', 'describeSnapshotsResponse_httpStatus' - The response's http status code.
newDescribeSnapshotsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSnapshotsResponse
newDescribeSnapshotsResponse :: Int -> DescribeSnapshotsResponse
newDescribeSnapshotsResponse Int
pHttpStatus_ =
  DescribeSnapshotsResponse' :: Maybe Text -> Maybe [Snapshot] -> Int -> DescribeSnapshotsResponse
DescribeSnapshotsResponse'
    { $sel:nextToken:DescribeSnapshotsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshots:DescribeSnapshotsResponse' :: Maybe [Snapshot]
snapshots = Maybe [Snapshot]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSnapshotsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If not null, more results are available. Pass this value in the
-- /NextToken/ member of a subsequent call to DescribeSnapshots.
describeSnapshotsResponse_nextToken :: Lens.Lens' DescribeSnapshotsResponse (Prelude.Maybe Prelude.Text)
describeSnapshotsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSnapshotsResponse -> f DescribeSnapshotsResponse
describeSnapshotsResponse_nextToken = (DescribeSnapshotsResponse -> Maybe Text)
-> (DescribeSnapshotsResponse
    -> Maybe Text -> DescribeSnapshotsResponse)
-> Lens' DescribeSnapshotsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSnapshotsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSnapshotsResponse' :: DescribeSnapshotsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSnapshotsResponse
s@DescribeSnapshotsResponse' {} Maybe Text
a -> DescribeSnapshotsResponse
s {$sel:nextToken:DescribeSnapshotsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSnapshotsResponse)

-- | The list of Snapshot objects that were retrieved.
--
-- It is possible that this list contains less than the number of items
-- specified in the /Limit/ member of the request. This occurs if there are
-- less than the requested number of items left to retrieve, or if the
-- limitations of the operation have been exceeded.
describeSnapshotsResponse_snapshots :: Lens.Lens' DescribeSnapshotsResponse (Prelude.Maybe [Snapshot])
describeSnapshotsResponse_snapshots :: (Maybe [Snapshot] -> f (Maybe [Snapshot]))
-> DescribeSnapshotsResponse -> f DescribeSnapshotsResponse
describeSnapshotsResponse_snapshots = (DescribeSnapshotsResponse -> Maybe [Snapshot])
-> (DescribeSnapshotsResponse
    -> Maybe [Snapshot] -> DescribeSnapshotsResponse)
-> Lens' DescribeSnapshotsResponse (Maybe [Snapshot])
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) ((Maybe [Snapshot] -> f (Maybe [Snapshot]))
 -> DescribeSnapshotsResponse -> f DescribeSnapshotsResponse)
-> ((Maybe [Snapshot] -> f (Maybe [Snapshot]))
    -> Maybe [Snapshot] -> f (Maybe [Snapshot]))
-> (Maybe [Snapshot] -> f (Maybe [Snapshot]))
-> DescribeSnapshotsResponse
-> f DescribeSnapshotsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Snapshot] [Snapshot] [Snapshot] [Snapshot]
-> Iso
     (Maybe [Snapshot])
     (Maybe [Snapshot])
     (Maybe [Snapshot])
     (Maybe [Snapshot])
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 [Snapshot] [Snapshot] [Snapshot] [Snapshot]
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 :: (Int -> f Int)
-> DescribeSnapshotsResponse -> f DescribeSnapshotsResponse
describeSnapshotsResponse_httpStatus = (DescribeSnapshotsResponse -> Int)
-> (DescribeSnapshotsResponse -> Int -> DescribeSnapshotsResponse)
-> Lens DescribeSnapshotsResponse DescribeSnapshotsResponse Int Int
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