{-# 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.KinesisVideoArchivedMedia.ListFragments
-- 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 Fragment objects from the specified stream and
-- timestamp range within the archived data.
--
-- Listing fragments is eventually consistent. This means that even if the
-- producer receives an acknowledgment that a fragment is persisted, the
-- result might not be returned immediately from a request to
-- @ListFragments@. However, results are typically available in less than
-- one second.
--
-- You must first call the @GetDataEndpoint@ API to get an endpoint. Then
-- send the @ListFragments@ requests to this endpoint using the
-- <https://docs.aws.amazon.com/cli/latest/reference/ --endpoint-url parameter>.
--
-- If an error is thrown after invoking a Kinesis Video Streams archived
-- media API, in addition to the HTTP status code and the response body, it
-- includes the following pieces of information:
--
-- -   @x-amz-ErrorType@ HTTP header – contains a more specific error type
--     in addition to what the HTTP status code provides.
--
-- -   @x-amz-RequestId@ HTTP header – if you want to report an issue to
--     AWS, the support team can better diagnose the problem if given the
--     Request Id.
--
-- Both the HTTP status code and the ErrorType header can be utilized to
-- make programmatic decisions about whether errors are retry-able and
-- under what conditions, as well as provide information on what actions
-- the client programmer might need to take in order to successfully try
-- again.
--
-- For more information, see the __Errors__ section at the bottom of this
-- topic, as well as
-- <https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/CommonErrors.html Common Errors>.
--
-- This operation returns paginated results.
module Amazonka.KinesisVideoArchivedMedia.ListFragments
  ( -- * Creating a Request
    ListFragments (..),
    newListFragments,

    -- * Request Lenses
    listFragments_fragmentSelector,
    listFragments_maxResults,
    listFragments_nextToken,
    listFragments_streamARN,
    listFragments_streamName,

    -- * Destructuring the Response
    ListFragmentsResponse (..),
    newListFragmentsResponse,

    -- * Response Lenses
    listFragmentsResponse_fragments,
    listFragmentsResponse_nextToken,
    listFragmentsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListFragments' smart constructor.
data ListFragments = ListFragments'
  { -- | Describes the timestamp range and timestamp origin for the range of
    -- fragments to return.
    ListFragments -> Maybe FragmentSelector
fragmentSelector :: Prelude.Maybe FragmentSelector,
    -- | The total number of fragments to return. If the total number of
    -- fragments available is more than the value specified in @max-results@,
    -- then a ListFragmentsOutput$NextToken is provided in the output that you
    -- can use to resume pagination.
    ListFragments -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A token to specify where to start paginating. This is the
    -- ListFragmentsOutput$NextToken from a previously truncated response.
    ListFragments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the stream from which to retrieve a
    -- fragment list. Specify either this parameter or the @StreamName@
    -- parameter.
    ListFragments -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the stream from which to retrieve a fragment list. Specify
    -- either this parameter or the @StreamARN@ parameter.
    ListFragments -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (ListFragments -> ListFragments -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFragments -> ListFragments -> Bool
$c/= :: ListFragments -> ListFragments -> Bool
== :: ListFragments -> ListFragments -> Bool
$c== :: ListFragments -> ListFragments -> Bool
Prelude.Eq, ReadPrec [ListFragments]
ReadPrec ListFragments
Int -> ReadS ListFragments
ReadS [ListFragments]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFragments]
$creadListPrec :: ReadPrec [ListFragments]
readPrec :: ReadPrec ListFragments
$creadPrec :: ReadPrec ListFragments
readList :: ReadS [ListFragments]
$creadList :: ReadS [ListFragments]
readsPrec :: Int -> ReadS ListFragments
$creadsPrec :: Int -> ReadS ListFragments
Prelude.Read, Int -> ListFragments -> ShowS
[ListFragments] -> ShowS
ListFragments -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFragments] -> ShowS
$cshowList :: [ListFragments] -> ShowS
show :: ListFragments -> String
$cshow :: ListFragments -> String
showsPrec :: Int -> ListFragments -> ShowS
$cshowsPrec :: Int -> ListFragments -> ShowS
Prelude.Show, forall x. Rep ListFragments x -> ListFragments
forall x. ListFragments -> Rep ListFragments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFragments x -> ListFragments
$cfrom :: forall x. ListFragments -> Rep ListFragments x
Prelude.Generic)

-- |
-- Create a value of 'ListFragments' 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:
--
-- 'fragmentSelector', 'listFragments_fragmentSelector' - Describes the timestamp range and timestamp origin for the range of
-- fragments to return.
--
-- 'maxResults', 'listFragments_maxResults' - The total number of fragments to return. If the total number of
-- fragments available is more than the value specified in @max-results@,
-- then a ListFragmentsOutput$NextToken is provided in the output that you
-- can use to resume pagination.
--
-- 'nextToken', 'listFragments_nextToken' - A token to specify where to start paginating. This is the
-- ListFragmentsOutput$NextToken from a previously truncated response.
--
-- 'streamARN', 'listFragments_streamARN' - The Amazon Resource Name (ARN) of the stream from which to retrieve a
-- fragment list. Specify either this parameter or the @StreamName@
-- parameter.
--
-- 'streamName', 'listFragments_streamName' - The name of the stream from which to retrieve a fragment list. Specify
-- either this parameter or the @StreamARN@ parameter.
newListFragments ::
  ListFragments
newListFragments :: ListFragments
newListFragments =
  ListFragments'
    { $sel:fragmentSelector:ListFragments' :: Maybe FragmentSelector
fragmentSelector = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListFragments' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFragments' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:streamARN:ListFragments' :: Maybe Text
streamARN = forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:ListFragments' :: Maybe Text
streamName = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the timestamp range and timestamp origin for the range of
-- fragments to return.
listFragments_fragmentSelector :: Lens.Lens' ListFragments (Prelude.Maybe FragmentSelector)
listFragments_fragmentSelector :: Lens' ListFragments (Maybe FragmentSelector)
listFragments_fragmentSelector = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFragments' {Maybe FragmentSelector
fragmentSelector :: Maybe FragmentSelector
$sel:fragmentSelector:ListFragments' :: ListFragments -> Maybe FragmentSelector
fragmentSelector} -> Maybe FragmentSelector
fragmentSelector) (\s :: ListFragments
s@ListFragments' {} Maybe FragmentSelector
a -> ListFragments
s {$sel:fragmentSelector:ListFragments' :: Maybe FragmentSelector
fragmentSelector = Maybe FragmentSelector
a} :: ListFragments)

-- | The total number of fragments to return. If the total number of
-- fragments available is more than the value specified in @max-results@,
-- then a ListFragmentsOutput$NextToken is provided in the output that you
-- can use to resume pagination.
listFragments_maxResults :: Lens.Lens' ListFragments (Prelude.Maybe Prelude.Natural)
listFragments_maxResults :: Lens' ListFragments (Maybe Natural)
listFragments_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFragments' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListFragments' :: ListFragments -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListFragments
s@ListFragments' {} Maybe Natural
a -> ListFragments
s {$sel:maxResults:ListFragments' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListFragments)

-- | A token to specify where to start paginating. This is the
-- ListFragmentsOutput$NextToken from a previously truncated response.
listFragments_nextToken :: Lens.Lens' ListFragments (Prelude.Maybe Prelude.Text)
listFragments_nextToken :: Lens' ListFragments (Maybe Text)
listFragments_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFragments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFragments' :: ListFragments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFragments
s@ListFragments' {} Maybe Text
a -> ListFragments
s {$sel:nextToken:ListFragments' :: Maybe Text
nextToken = Maybe Text
a} :: ListFragments)

-- | The Amazon Resource Name (ARN) of the stream from which to retrieve a
-- fragment list. Specify either this parameter or the @StreamName@
-- parameter.
listFragments_streamARN :: Lens.Lens' ListFragments (Prelude.Maybe Prelude.Text)
listFragments_streamARN :: Lens' ListFragments (Maybe Text)
listFragments_streamARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFragments' {Maybe Text
streamARN :: Maybe Text
$sel:streamARN:ListFragments' :: ListFragments -> Maybe Text
streamARN} -> Maybe Text
streamARN) (\s :: ListFragments
s@ListFragments' {} Maybe Text
a -> ListFragments
s {$sel:streamARN:ListFragments' :: Maybe Text
streamARN = Maybe Text
a} :: ListFragments)

-- | The name of the stream from which to retrieve a fragment list. Specify
-- either this parameter or the @StreamARN@ parameter.
listFragments_streamName :: Lens.Lens' ListFragments (Prelude.Maybe Prelude.Text)
listFragments_streamName :: Lens' ListFragments (Maybe Text)
listFragments_streamName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFragments' {Maybe Text
streamName :: Maybe Text
$sel:streamName:ListFragments' :: ListFragments -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: ListFragments
s@ListFragments' {} Maybe Text
a -> ListFragments
s {$sel:streamName:ListFragments' :: Maybe Text
streamName = Maybe Text
a} :: ListFragments)

instance Core.AWSPager ListFragments where
  page :: ListFragments -> AWSResponse ListFragments -> Maybe ListFragments
page ListFragments
rq AWSResponse ListFragments
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFragments
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListFragmentsResponse (Maybe Text)
listFragmentsResponse_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 ListFragments
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListFragmentsResponse (Maybe [Fragment])
listFragmentsResponse_fragments
            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.$ ListFragments
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListFragments (Maybe Text)
listFragments_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListFragments
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListFragmentsResponse (Maybe Text)
listFragmentsResponse_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 ListFragments where
  type
    AWSResponse ListFragments =
      ListFragmentsResponse
  request :: (Service -> Service) -> ListFragments -> Request ListFragments
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 ListFragments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFragments)))
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 [Fragment] -> Maybe Text -> Int -> ListFragmentsResponse
ListFragmentsResponse'
            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
"Fragments" 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.<*> (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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListFragments where
  hashWithSalt :: Int -> ListFragments -> Int
hashWithSalt Int
_salt ListFragments' {Maybe Natural
Maybe Text
Maybe FragmentSelector
streamName :: Maybe Text
streamARN :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
fragmentSelector :: Maybe FragmentSelector
$sel:streamName:ListFragments' :: ListFragments -> Maybe Text
$sel:streamARN:ListFragments' :: ListFragments -> Maybe Text
$sel:nextToken:ListFragments' :: ListFragments -> Maybe Text
$sel:maxResults:ListFragments' :: ListFragments -> Maybe Natural
$sel:fragmentSelector:ListFragments' :: ListFragments -> Maybe FragmentSelector
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FragmentSelector
fragmentSelector
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamName

instance Prelude.NFData ListFragments where
  rnf :: ListFragments -> ()
rnf ListFragments' {Maybe Natural
Maybe Text
Maybe FragmentSelector
streamName :: Maybe Text
streamARN :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
fragmentSelector :: Maybe FragmentSelector
$sel:streamName:ListFragments' :: ListFragments -> Maybe Text
$sel:streamARN:ListFragments' :: ListFragments -> Maybe Text
$sel:nextToken:ListFragments' :: ListFragments -> Maybe Text
$sel:maxResults:ListFragments' :: ListFragments -> Maybe Natural
$sel:fragmentSelector:ListFragments' :: ListFragments -> Maybe FragmentSelector
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FragmentSelector
fragmentSelector
      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
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamName

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

instance Data.ToJSON ListFragments where
  toJSON :: ListFragments -> Value
toJSON ListFragments' {Maybe Natural
Maybe Text
Maybe FragmentSelector
streamName :: Maybe Text
streamARN :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
fragmentSelector :: Maybe FragmentSelector
$sel:streamName:ListFragments' :: ListFragments -> Maybe Text
$sel:streamARN:ListFragments' :: ListFragments -> Maybe Text
$sel:nextToken:ListFragments' :: ListFragments -> Maybe Text
$sel:maxResults:ListFragments' :: ListFragments -> Maybe Natural
$sel:fragmentSelector:ListFragments' :: ListFragments -> Maybe FragmentSelector
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"FragmentSelector" 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 FragmentSelector
fragmentSelector,
            (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
"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
"StreamARN" 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
streamARN,
            (Key
"StreamName" 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
streamName
          ]
      )

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

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

-- | /See:/ 'newListFragmentsResponse' smart constructor.
data ListFragmentsResponse = ListFragmentsResponse'
  { -- | A list of archived Fragment objects from the stream that meet the
    -- selector criteria. Results are in no specific order, even across pages.
    ListFragmentsResponse -> Maybe [Fragment]
fragments :: Prelude.Maybe [Fragment],
    -- | If the returned list is truncated, the operation returns this token to
    -- use to retrieve the next page of results. This value is @null@ when
    -- there are no more results to return.
    ListFragmentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListFragmentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListFragmentsResponse -> ListFragmentsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFragmentsResponse -> ListFragmentsResponse -> Bool
$c/= :: ListFragmentsResponse -> ListFragmentsResponse -> Bool
== :: ListFragmentsResponse -> ListFragmentsResponse -> Bool
$c== :: ListFragmentsResponse -> ListFragmentsResponse -> Bool
Prelude.Eq, ReadPrec [ListFragmentsResponse]
ReadPrec ListFragmentsResponse
Int -> ReadS ListFragmentsResponse
ReadS [ListFragmentsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFragmentsResponse]
$creadListPrec :: ReadPrec [ListFragmentsResponse]
readPrec :: ReadPrec ListFragmentsResponse
$creadPrec :: ReadPrec ListFragmentsResponse
readList :: ReadS [ListFragmentsResponse]
$creadList :: ReadS [ListFragmentsResponse]
readsPrec :: Int -> ReadS ListFragmentsResponse
$creadsPrec :: Int -> ReadS ListFragmentsResponse
Prelude.Read, Int -> ListFragmentsResponse -> ShowS
[ListFragmentsResponse] -> ShowS
ListFragmentsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFragmentsResponse] -> ShowS
$cshowList :: [ListFragmentsResponse] -> ShowS
show :: ListFragmentsResponse -> String
$cshow :: ListFragmentsResponse -> String
showsPrec :: Int -> ListFragmentsResponse -> ShowS
$cshowsPrec :: Int -> ListFragmentsResponse -> ShowS
Prelude.Show, forall x. Rep ListFragmentsResponse x -> ListFragmentsResponse
forall x. ListFragmentsResponse -> Rep ListFragmentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFragmentsResponse x -> ListFragmentsResponse
$cfrom :: forall x. ListFragmentsResponse -> Rep ListFragmentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListFragmentsResponse' 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:
--
-- 'fragments', 'listFragmentsResponse_fragments' - A list of archived Fragment objects from the stream that meet the
-- selector criteria. Results are in no specific order, even across pages.
--
-- 'nextToken', 'listFragmentsResponse_nextToken' - If the returned list is truncated, the operation returns this token to
-- use to retrieve the next page of results. This value is @null@ when
-- there are no more results to return.
--
-- 'httpStatus', 'listFragmentsResponse_httpStatus' - The response's http status code.
newListFragmentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListFragmentsResponse
newListFragmentsResponse :: Int -> ListFragmentsResponse
newListFragmentsResponse Int
pHttpStatus_ =
  ListFragmentsResponse'
    { $sel:fragments:ListFragmentsResponse' :: Maybe [Fragment]
fragments = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFragmentsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListFragmentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of archived Fragment objects from the stream that meet the
-- selector criteria. Results are in no specific order, even across pages.
listFragmentsResponse_fragments :: Lens.Lens' ListFragmentsResponse (Prelude.Maybe [Fragment])
listFragmentsResponse_fragments :: Lens' ListFragmentsResponse (Maybe [Fragment])
listFragmentsResponse_fragments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFragmentsResponse' {Maybe [Fragment]
fragments :: Maybe [Fragment]
$sel:fragments:ListFragmentsResponse' :: ListFragmentsResponse -> Maybe [Fragment]
fragments} -> Maybe [Fragment]
fragments) (\s :: ListFragmentsResponse
s@ListFragmentsResponse' {} Maybe [Fragment]
a -> ListFragmentsResponse
s {$sel:fragments:ListFragmentsResponse' :: Maybe [Fragment]
fragments = Maybe [Fragment]
a} :: ListFragmentsResponse) 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

-- | If the returned list is truncated, the operation returns this token to
-- use to retrieve the next page of results. This value is @null@ when
-- there are no more results to return.
listFragmentsResponse_nextToken :: Lens.Lens' ListFragmentsResponse (Prelude.Maybe Prelude.Text)
listFragmentsResponse_nextToken :: Lens' ListFragmentsResponse (Maybe Text)
listFragmentsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFragmentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFragmentsResponse' :: ListFragmentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFragmentsResponse
s@ListFragmentsResponse' {} Maybe Text
a -> ListFragmentsResponse
s {$sel:nextToken:ListFragmentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFragmentsResponse)

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

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