{-# 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.EBS.ListChangedBlocks
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about the blocks that are different between two
-- Amazon Elastic Block Store snapshots of the same volume\/snapshot
-- lineage.
module Amazonka.EBS.ListChangedBlocks
  ( -- * Creating a Request
    ListChangedBlocks (..),
    newListChangedBlocks,

    -- * Request Lenses
    listChangedBlocks_nextToken,
    listChangedBlocks_startingBlockIndex,
    listChangedBlocks_firstSnapshotId,
    listChangedBlocks_maxResults,
    listChangedBlocks_secondSnapshotId,

    -- * Destructuring the Response
    ListChangedBlocksResponse (..),
    newListChangedBlocksResponse,

    -- * Response Lenses
    listChangedBlocksResponse_blockSize,
    listChangedBlocksResponse_expiryTime,
    listChangedBlocksResponse_volumeSize,
    listChangedBlocksResponse_changedBlocks,
    listChangedBlocksResponse_nextToken,
    listChangedBlocksResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListChangedBlocks' smart constructor.
data ListChangedBlocks = ListChangedBlocks'
  { -- | The token to request the next page of results.
    ListChangedBlocks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The block index from which the comparison should start.
    --
    -- The list in the response will start from this block index or the next
    -- valid block index in the snapshots.
    ListChangedBlocks -> Maybe Natural
startingBlockIndex :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the first snapshot to use for the comparison.
    --
    -- The @FirstSnapshotID@ parameter must be specified with a
    -- @SecondSnapshotId@ parameter; otherwise, an error occurs.
    ListChangedBlocks -> Maybe Text
firstSnapshotId :: Prelude.Maybe Prelude.Text,
    -- | The number of results to return.
    ListChangedBlocks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the second snapshot to use for the comparison.
    --
    -- The @SecondSnapshotId@ parameter must be specified with a
    -- @FirstSnapshotID@ parameter; otherwise, an error occurs.
    ListChangedBlocks -> Text
secondSnapshotId :: Prelude.Text
  }
  deriving (ListChangedBlocks -> ListChangedBlocks -> Bool
(ListChangedBlocks -> ListChangedBlocks -> Bool)
-> (ListChangedBlocks -> ListChangedBlocks -> Bool)
-> Eq ListChangedBlocks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChangedBlocks -> ListChangedBlocks -> Bool
$c/= :: ListChangedBlocks -> ListChangedBlocks -> Bool
== :: ListChangedBlocks -> ListChangedBlocks -> Bool
$c== :: ListChangedBlocks -> ListChangedBlocks -> Bool
Prelude.Eq, ReadPrec [ListChangedBlocks]
ReadPrec ListChangedBlocks
Int -> ReadS ListChangedBlocks
ReadS [ListChangedBlocks]
(Int -> ReadS ListChangedBlocks)
-> ReadS [ListChangedBlocks]
-> ReadPrec ListChangedBlocks
-> ReadPrec [ListChangedBlocks]
-> Read ListChangedBlocks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListChangedBlocks]
$creadListPrec :: ReadPrec [ListChangedBlocks]
readPrec :: ReadPrec ListChangedBlocks
$creadPrec :: ReadPrec ListChangedBlocks
readList :: ReadS [ListChangedBlocks]
$creadList :: ReadS [ListChangedBlocks]
readsPrec :: Int -> ReadS ListChangedBlocks
$creadsPrec :: Int -> ReadS ListChangedBlocks
Prelude.Read, Int -> ListChangedBlocks -> ShowS
[ListChangedBlocks] -> ShowS
ListChangedBlocks -> String
(Int -> ListChangedBlocks -> ShowS)
-> (ListChangedBlocks -> String)
-> ([ListChangedBlocks] -> ShowS)
-> Show ListChangedBlocks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChangedBlocks] -> ShowS
$cshowList :: [ListChangedBlocks] -> ShowS
show :: ListChangedBlocks -> String
$cshow :: ListChangedBlocks -> String
showsPrec :: Int -> ListChangedBlocks -> ShowS
$cshowsPrec :: Int -> ListChangedBlocks -> ShowS
Prelude.Show, (forall x. ListChangedBlocks -> Rep ListChangedBlocks x)
-> (forall x. Rep ListChangedBlocks x -> ListChangedBlocks)
-> Generic ListChangedBlocks
forall x. Rep ListChangedBlocks x -> ListChangedBlocks
forall x. ListChangedBlocks -> Rep ListChangedBlocks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListChangedBlocks x -> ListChangedBlocks
$cfrom :: forall x. ListChangedBlocks -> Rep ListChangedBlocks x
Prelude.Generic)

-- |
-- Create a value of 'ListChangedBlocks' 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', 'listChangedBlocks_nextToken' - The token to request the next page of results.
--
-- 'startingBlockIndex', 'listChangedBlocks_startingBlockIndex' - The block index from which the comparison should start.
--
-- The list in the response will start from this block index or the next
-- valid block index in the snapshots.
--
-- 'firstSnapshotId', 'listChangedBlocks_firstSnapshotId' - The ID of the first snapshot to use for the comparison.
--
-- The @FirstSnapshotID@ parameter must be specified with a
-- @SecondSnapshotId@ parameter; otherwise, an error occurs.
--
-- 'maxResults', 'listChangedBlocks_maxResults' - The number of results to return.
--
-- 'secondSnapshotId', 'listChangedBlocks_secondSnapshotId' - The ID of the second snapshot to use for the comparison.
--
-- The @SecondSnapshotId@ parameter must be specified with a
-- @FirstSnapshotID@ parameter; otherwise, an error occurs.
newListChangedBlocks ::
  -- | 'secondSnapshotId'
  Prelude.Text ->
  ListChangedBlocks
newListChangedBlocks :: Text -> ListChangedBlocks
newListChangedBlocks Text
pSecondSnapshotId_ =
  ListChangedBlocks' :: Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Natural
-> Text
-> ListChangedBlocks
ListChangedBlocks'
    { $sel:nextToken:ListChangedBlocks' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startingBlockIndex:ListChangedBlocks' :: Maybe Natural
startingBlockIndex = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:firstSnapshotId:ListChangedBlocks' :: Maybe Text
firstSnapshotId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListChangedBlocks' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:secondSnapshotId:ListChangedBlocks' :: Text
secondSnapshotId = Text
pSecondSnapshotId_
    }

-- | The token to request the next page of results.
listChangedBlocks_nextToken :: Lens.Lens' ListChangedBlocks (Prelude.Maybe Prelude.Text)
listChangedBlocks_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListChangedBlocks -> f ListChangedBlocks
listChangedBlocks_nextToken = (ListChangedBlocks -> Maybe Text)
-> (ListChangedBlocks -> Maybe Text -> ListChangedBlocks)
-> Lens
     ListChangedBlocks ListChangedBlocks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListChangedBlocks' :: ListChangedBlocks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListChangedBlocks
s@ListChangedBlocks' {} Maybe Text
a -> ListChangedBlocks
s {$sel:nextToken:ListChangedBlocks' :: Maybe Text
nextToken = Maybe Text
a} :: ListChangedBlocks)

-- | The block index from which the comparison should start.
--
-- The list in the response will start from this block index or the next
-- valid block index in the snapshots.
listChangedBlocks_startingBlockIndex :: Lens.Lens' ListChangedBlocks (Prelude.Maybe Prelude.Natural)
listChangedBlocks_startingBlockIndex :: (Maybe Natural -> f (Maybe Natural))
-> ListChangedBlocks -> f ListChangedBlocks
listChangedBlocks_startingBlockIndex = (ListChangedBlocks -> Maybe Natural)
-> (ListChangedBlocks -> Maybe Natural -> ListChangedBlocks)
-> Lens
     ListChangedBlocks ListChangedBlocks (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocks' {Maybe Natural
startingBlockIndex :: Maybe Natural
$sel:startingBlockIndex:ListChangedBlocks' :: ListChangedBlocks -> Maybe Natural
startingBlockIndex} -> Maybe Natural
startingBlockIndex) (\s :: ListChangedBlocks
s@ListChangedBlocks' {} Maybe Natural
a -> ListChangedBlocks
s {$sel:startingBlockIndex:ListChangedBlocks' :: Maybe Natural
startingBlockIndex = Maybe Natural
a} :: ListChangedBlocks)

-- | The ID of the first snapshot to use for the comparison.
--
-- The @FirstSnapshotID@ parameter must be specified with a
-- @SecondSnapshotId@ parameter; otherwise, an error occurs.
listChangedBlocks_firstSnapshotId :: Lens.Lens' ListChangedBlocks (Prelude.Maybe Prelude.Text)
listChangedBlocks_firstSnapshotId :: (Maybe Text -> f (Maybe Text))
-> ListChangedBlocks -> f ListChangedBlocks
listChangedBlocks_firstSnapshotId = (ListChangedBlocks -> Maybe Text)
-> (ListChangedBlocks -> Maybe Text -> ListChangedBlocks)
-> Lens
     ListChangedBlocks ListChangedBlocks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocks' {Maybe Text
firstSnapshotId :: Maybe Text
$sel:firstSnapshotId:ListChangedBlocks' :: ListChangedBlocks -> Maybe Text
firstSnapshotId} -> Maybe Text
firstSnapshotId) (\s :: ListChangedBlocks
s@ListChangedBlocks' {} Maybe Text
a -> ListChangedBlocks
s {$sel:firstSnapshotId:ListChangedBlocks' :: Maybe Text
firstSnapshotId = Maybe Text
a} :: ListChangedBlocks)

-- | The number of results to return.
listChangedBlocks_maxResults :: Lens.Lens' ListChangedBlocks (Prelude.Maybe Prelude.Natural)
listChangedBlocks_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListChangedBlocks -> f ListChangedBlocks
listChangedBlocks_maxResults = (ListChangedBlocks -> Maybe Natural)
-> (ListChangedBlocks -> Maybe Natural -> ListChangedBlocks)
-> Lens
     ListChangedBlocks ListChangedBlocks (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListChangedBlocks' :: ListChangedBlocks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListChangedBlocks
s@ListChangedBlocks' {} Maybe Natural
a -> ListChangedBlocks
s {$sel:maxResults:ListChangedBlocks' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListChangedBlocks)

-- | The ID of the second snapshot to use for the comparison.
--
-- The @SecondSnapshotId@ parameter must be specified with a
-- @FirstSnapshotID@ parameter; otherwise, an error occurs.
listChangedBlocks_secondSnapshotId :: Lens.Lens' ListChangedBlocks Prelude.Text
listChangedBlocks_secondSnapshotId :: (Text -> f Text) -> ListChangedBlocks -> f ListChangedBlocks
listChangedBlocks_secondSnapshotId = (ListChangedBlocks -> Text)
-> (ListChangedBlocks -> Text -> ListChangedBlocks)
-> Lens ListChangedBlocks ListChangedBlocks Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocks' {Text
secondSnapshotId :: Text
$sel:secondSnapshotId:ListChangedBlocks' :: ListChangedBlocks -> Text
secondSnapshotId} -> Text
secondSnapshotId) (\s :: ListChangedBlocks
s@ListChangedBlocks' {} Text
a -> ListChangedBlocks
s {$sel:secondSnapshotId:ListChangedBlocks' :: Text
secondSnapshotId = Text
a} :: ListChangedBlocks)

instance Core.AWSRequest ListChangedBlocks where
  type
    AWSResponse ListChangedBlocks =
      ListChangedBlocksResponse
  request :: ListChangedBlocks -> Request ListChangedBlocks
request = Service -> ListChangedBlocks -> Request ListChangedBlocks
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListChangedBlocks
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListChangedBlocks)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListChangedBlocks))
-> Logger
-> Service
-> Proxy ListChangedBlocks
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListChangedBlocks)))
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 Int
-> Maybe POSIX
-> Maybe Natural
-> Maybe [Sensitive ChangedBlock]
-> Maybe Text
-> Int
-> ListChangedBlocksResponse
ListChangedBlocksResponse'
            (Maybe Int
 -> Maybe POSIX
 -> Maybe Natural
 -> Maybe [Sensitive ChangedBlock]
 -> Maybe Text
 -> Int
 -> ListChangedBlocksResponse)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe POSIX
      -> Maybe Natural
      -> Maybe [Sensitive ChangedBlock]
      -> Maybe Text
      -> Int
      -> ListChangedBlocksResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BlockSize")
            Either
  String
  (Maybe POSIX
   -> Maybe Natural
   -> Maybe [Sensitive ChangedBlock]
   -> Maybe Text
   -> Int
   -> ListChangedBlocksResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe Natural
      -> Maybe [Sensitive ChangedBlock]
      -> Maybe Text
      -> Int
      -> ListChangedBlocksResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ExpiryTime")
            Either
  String
  (Maybe Natural
   -> Maybe [Sensitive ChangedBlock]
   -> Maybe Text
   -> Int
   -> ListChangedBlocksResponse)
-> Either String (Maybe Natural)
-> Either
     String
     (Maybe [Sensitive ChangedBlock]
      -> Maybe Text -> Int -> ListChangedBlocksResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VolumeSize")
            Either
  String
  (Maybe [Sensitive ChangedBlock]
   -> Maybe Text -> Int -> ListChangedBlocksResponse)
-> Either String (Maybe [Sensitive ChangedBlock])
-> Either String (Maybe Text -> Int -> ListChangedBlocksResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [Sensitive ChangedBlock]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChangedBlocks" Either String (Maybe (Maybe [Sensitive ChangedBlock]))
-> Maybe [Sensitive ChangedBlock]
-> Either String (Maybe [Sensitive ChangedBlock])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Sensitive ChangedBlock]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListChangedBlocksResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListChangedBlocksResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> ListChangedBlocksResponse)
-> Either String Int -> Either String ListChangedBlocksResponse
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 ListChangedBlocks

instance Prelude.NFData ListChangedBlocks

instance Core.ToHeaders ListChangedBlocks where
  toHeaders :: ListChangedBlocks -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListChangedBlocks -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath ListChangedBlocks where
  toPath :: ListChangedBlocks -> ByteString
toPath ListChangedBlocks' {Maybe Natural
Maybe Text
Text
secondSnapshotId :: Text
maxResults :: Maybe Natural
firstSnapshotId :: Maybe Text
startingBlockIndex :: Maybe Natural
nextToken :: Maybe Text
$sel:secondSnapshotId:ListChangedBlocks' :: ListChangedBlocks -> Text
$sel:maxResults:ListChangedBlocks' :: ListChangedBlocks -> Maybe Natural
$sel:firstSnapshotId:ListChangedBlocks' :: ListChangedBlocks -> Maybe Text
$sel:startingBlockIndex:ListChangedBlocks' :: ListChangedBlocks -> Maybe Natural
$sel:nextToken:ListChangedBlocks' :: ListChangedBlocks -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/snapshots/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
secondSnapshotId,
        ByteString
"/changedblocks"
      ]

instance Core.ToQuery ListChangedBlocks where
  toQuery :: ListChangedBlocks -> QueryString
toQuery ListChangedBlocks' {Maybe Natural
Maybe Text
Text
secondSnapshotId :: Text
maxResults :: Maybe Natural
firstSnapshotId :: Maybe Text
startingBlockIndex :: Maybe Natural
nextToken :: Maybe Text
$sel:secondSnapshotId:ListChangedBlocks' :: ListChangedBlocks -> Text
$sel:maxResults:ListChangedBlocks' :: ListChangedBlocks -> Maybe Natural
$sel:firstSnapshotId:ListChangedBlocks' :: ListChangedBlocks -> Maybe Text
$sel:startingBlockIndex:ListChangedBlocks' :: ListChangedBlocks -> Maybe Natural
$sel:nextToken:ListChangedBlocks' :: ListChangedBlocks -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"pageToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"startingBlockIndex" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
startingBlockIndex,
        ByteString
"firstSnapshotId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
firstSnapshotId,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListChangedBlocksResponse' smart constructor.
data ListChangedBlocksResponse = ListChangedBlocksResponse'
  { -- | The size of the blocks in the snapshot, in bytes.
    ListChangedBlocksResponse -> Maybe Int
blockSize :: Prelude.Maybe Prelude.Int,
    -- | The time when the @BlockToken@ expires.
    ListChangedBlocksResponse -> Maybe POSIX
expiryTime :: Prelude.Maybe Core.POSIX,
    -- | The size of the volume in GB.
    ListChangedBlocksResponse -> Maybe Natural
volumeSize :: Prelude.Maybe Prelude.Natural,
    -- | An array of objects containing information about the changed blocks.
    ListChangedBlocksResponse -> Maybe [Sensitive ChangedBlock]
changedBlocks :: Prelude.Maybe [Core.Sensitive ChangedBlock],
    -- | The token to use to retrieve the next page of results. This value is
    -- null when there are no more results to return.
    ListChangedBlocksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListChangedBlocksResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListChangedBlocksResponse -> ListChangedBlocksResponse -> Bool
(ListChangedBlocksResponse -> ListChangedBlocksResponse -> Bool)
-> (ListChangedBlocksResponse -> ListChangedBlocksResponse -> Bool)
-> Eq ListChangedBlocksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChangedBlocksResponse -> ListChangedBlocksResponse -> Bool
$c/= :: ListChangedBlocksResponse -> ListChangedBlocksResponse -> Bool
== :: ListChangedBlocksResponse -> ListChangedBlocksResponse -> Bool
$c== :: ListChangedBlocksResponse -> ListChangedBlocksResponse -> Bool
Prelude.Eq, Int -> ListChangedBlocksResponse -> ShowS
[ListChangedBlocksResponse] -> ShowS
ListChangedBlocksResponse -> String
(Int -> ListChangedBlocksResponse -> ShowS)
-> (ListChangedBlocksResponse -> String)
-> ([ListChangedBlocksResponse] -> ShowS)
-> Show ListChangedBlocksResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChangedBlocksResponse] -> ShowS
$cshowList :: [ListChangedBlocksResponse] -> ShowS
show :: ListChangedBlocksResponse -> String
$cshow :: ListChangedBlocksResponse -> String
showsPrec :: Int -> ListChangedBlocksResponse -> ShowS
$cshowsPrec :: Int -> ListChangedBlocksResponse -> ShowS
Prelude.Show, (forall x.
 ListChangedBlocksResponse -> Rep ListChangedBlocksResponse x)
-> (forall x.
    Rep ListChangedBlocksResponse x -> ListChangedBlocksResponse)
-> Generic ListChangedBlocksResponse
forall x.
Rep ListChangedBlocksResponse x -> ListChangedBlocksResponse
forall x.
ListChangedBlocksResponse -> Rep ListChangedBlocksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListChangedBlocksResponse x -> ListChangedBlocksResponse
$cfrom :: forall x.
ListChangedBlocksResponse -> Rep ListChangedBlocksResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListChangedBlocksResponse' 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:
--
-- 'blockSize', 'listChangedBlocksResponse_blockSize' - The size of the blocks in the snapshot, in bytes.
--
-- 'expiryTime', 'listChangedBlocksResponse_expiryTime' - The time when the @BlockToken@ expires.
--
-- 'volumeSize', 'listChangedBlocksResponse_volumeSize' - The size of the volume in GB.
--
-- 'changedBlocks', 'listChangedBlocksResponse_changedBlocks' - An array of objects containing information about the changed blocks.
--
-- 'nextToken', 'listChangedBlocksResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- null when there are no more results to return.
--
-- 'httpStatus', 'listChangedBlocksResponse_httpStatus' - The response's http status code.
newListChangedBlocksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListChangedBlocksResponse
newListChangedBlocksResponse :: Int -> ListChangedBlocksResponse
newListChangedBlocksResponse Int
pHttpStatus_ =
  ListChangedBlocksResponse' :: Maybe Int
-> Maybe POSIX
-> Maybe Natural
-> Maybe [Sensitive ChangedBlock]
-> Maybe Text
-> Int
-> ListChangedBlocksResponse
ListChangedBlocksResponse'
    { $sel:blockSize:ListChangedBlocksResponse' :: Maybe Int
blockSize =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:expiryTime:ListChangedBlocksResponse' :: Maybe POSIX
expiryTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeSize:ListChangedBlocksResponse' :: Maybe Natural
volumeSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:changedBlocks:ListChangedBlocksResponse' :: Maybe [Sensitive ChangedBlock]
changedBlocks = Maybe [Sensitive ChangedBlock]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListChangedBlocksResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListChangedBlocksResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The size of the blocks in the snapshot, in bytes.
listChangedBlocksResponse_blockSize :: Lens.Lens' ListChangedBlocksResponse (Prelude.Maybe Prelude.Int)
listChangedBlocksResponse_blockSize :: (Maybe Int -> f (Maybe Int))
-> ListChangedBlocksResponse -> f ListChangedBlocksResponse
listChangedBlocksResponse_blockSize = (ListChangedBlocksResponse -> Maybe Int)
-> (ListChangedBlocksResponse
    -> Maybe Int -> ListChangedBlocksResponse)
-> Lens
     ListChangedBlocksResponse
     ListChangedBlocksResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocksResponse' {Maybe Int
blockSize :: Maybe Int
$sel:blockSize:ListChangedBlocksResponse' :: ListChangedBlocksResponse -> Maybe Int
blockSize} -> Maybe Int
blockSize) (\s :: ListChangedBlocksResponse
s@ListChangedBlocksResponse' {} Maybe Int
a -> ListChangedBlocksResponse
s {$sel:blockSize:ListChangedBlocksResponse' :: Maybe Int
blockSize = Maybe Int
a} :: ListChangedBlocksResponse)

-- | The time when the @BlockToken@ expires.
listChangedBlocksResponse_expiryTime :: Lens.Lens' ListChangedBlocksResponse (Prelude.Maybe Prelude.UTCTime)
listChangedBlocksResponse_expiryTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListChangedBlocksResponse -> f ListChangedBlocksResponse
listChangedBlocksResponse_expiryTime = (ListChangedBlocksResponse -> Maybe POSIX)
-> (ListChangedBlocksResponse
    -> Maybe POSIX -> ListChangedBlocksResponse)
-> Lens
     ListChangedBlocksResponse
     ListChangedBlocksResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocksResponse' {Maybe POSIX
expiryTime :: Maybe POSIX
$sel:expiryTime:ListChangedBlocksResponse' :: ListChangedBlocksResponse -> Maybe POSIX
expiryTime} -> Maybe POSIX
expiryTime) (\s :: ListChangedBlocksResponse
s@ListChangedBlocksResponse' {} Maybe POSIX
a -> ListChangedBlocksResponse
s {$sel:expiryTime:ListChangedBlocksResponse' :: Maybe POSIX
expiryTime = Maybe POSIX
a} :: ListChangedBlocksResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListChangedBlocksResponse -> f ListChangedBlocksResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListChangedBlocksResponse
-> f ListChangedBlocksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The size of the volume in GB.
listChangedBlocksResponse_volumeSize :: Lens.Lens' ListChangedBlocksResponse (Prelude.Maybe Prelude.Natural)
listChangedBlocksResponse_volumeSize :: (Maybe Natural -> f (Maybe Natural))
-> ListChangedBlocksResponse -> f ListChangedBlocksResponse
listChangedBlocksResponse_volumeSize = (ListChangedBlocksResponse -> Maybe Natural)
-> (ListChangedBlocksResponse
    -> Maybe Natural -> ListChangedBlocksResponse)
-> Lens
     ListChangedBlocksResponse
     ListChangedBlocksResponse
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocksResponse' {Maybe Natural
volumeSize :: Maybe Natural
$sel:volumeSize:ListChangedBlocksResponse' :: ListChangedBlocksResponse -> Maybe Natural
volumeSize} -> Maybe Natural
volumeSize) (\s :: ListChangedBlocksResponse
s@ListChangedBlocksResponse' {} Maybe Natural
a -> ListChangedBlocksResponse
s {$sel:volumeSize:ListChangedBlocksResponse' :: Maybe Natural
volumeSize = Maybe Natural
a} :: ListChangedBlocksResponse)

-- | An array of objects containing information about the changed blocks.
listChangedBlocksResponse_changedBlocks :: Lens.Lens' ListChangedBlocksResponse (Prelude.Maybe [ChangedBlock])
listChangedBlocksResponse_changedBlocks :: (Maybe [ChangedBlock] -> f (Maybe [ChangedBlock]))
-> ListChangedBlocksResponse -> f ListChangedBlocksResponse
listChangedBlocksResponse_changedBlocks = (ListChangedBlocksResponse -> Maybe [Sensitive ChangedBlock])
-> (ListChangedBlocksResponse
    -> Maybe [Sensitive ChangedBlock] -> ListChangedBlocksResponse)
-> Lens
     ListChangedBlocksResponse
     ListChangedBlocksResponse
     (Maybe [Sensitive ChangedBlock])
     (Maybe [Sensitive ChangedBlock])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocksResponse' {Maybe [Sensitive ChangedBlock]
changedBlocks :: Maybe [Sensitive ChangedBlock]
$sel:changedBlocks:ListChangedBlocksResponse' :: ListChangedBlocksResponse -> Maybe [Sensitive ChangedBlock]
changedBlocks} -> Maybe [Sensitive ChangedBlock]
changedBlocks) (\s :: ListChangedBlocksResponse
s@ListChangedBlocksResponse' {} Maybe [Sensitive ChangedBlock]
a -> ListChangedBlocksResponse
s {$sel:changedBlocks:ListChangedBlocksResponse' :: Maybe [Sensitive ChangedBlock]
changedBlocks = Maybe [Sensitive ChangedBlock]
a} :: ListChangedBlocksResponse) ((Maybe [Sensitive ChangedBlock]
  -> f (Maybe [Sensitive ChangedBlock]))
 -> ListChangedBlocksResponse -> f ListChangedBlocksResponse)
-> ((Maybe [ChangedBlock] -> f (Maybe [ChangedBlock]))
    -> Maybe [Sensitive ChangedBlock]
    -> f (Maybe [Sensitive ChangedBlock]))
-> (Maybe [ChangedBlock] -> f (Maybe [ChangedBlock]))
-> ListChangedBlocksResponse
-> f ListChangedBlocksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [Sensitive ChangedBlock]
  [Sensitive ChangedBlock]
  [ChangedBlock]
  [ChangedBlock]
-> Iso
     (Maybe [Sensitive ChangedBlock])
     (Maybe [Sensitive ChangedBlock])
     (Maybe [ChangedBlock])
     (Maybe [ChangedBlock])
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
  [Sensitive ChangedBlock]
  [Sensitive ChangedBlock]
  [ChangedBlock]
  [ChangedBlock]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to use to retrieve the next page of results. This value is
-- null when there are no more results to return.
listChangedBlocksResponse_nextToken :: Lens.Lens' ListChangedBlocksResponse (Prelude.Maybe Prelude.Text)
listChangedBlocksResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListChangedBlocksResponse -> f ListChangedBlocksResponse
listChangedBlocksResponse_nextToken = (ListChangedBlocksResponse -> Maybe Text)
-> (ListChangedBlocksResponse
    -> Maybe Text -> ListChangedBlocksResponse)
-> Lens
     ListChangedBlocksResponse
     ListChangedBlocksResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChangedBlocksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListChangedBlocksResponse' :: ListChangedBlocksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListChangedBlocksResponse
s@ListChangedBlocksResponse' {} Maybe Text
a -> ListChangedBlocksResponse
s {$sel:nextToken:ListChangedBlocksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListChangedBlocksResponse)

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

instance Prelude.NFData ListChangedBlocksResponse