{-# 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.RDS.DescribeExportTasks
-- 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 a snapshot export to Amazon S3. This API
-- operation supports pagination.
--
-- This operation returns paginated results.
module Amazonka.RDS.DescribeExportTasks
  ( -- * Creating a Request
    DescribeExportTasks (..),
    newDescribeExportTasks,

    -- * Request Lenses
    describeExportTasks_sourceArn,
    describeExportTasks_filters,
    describeExportTasks_marker,
    describeExportTasks_exportTaskIdentifier,
    describeExportTasks_maxRecords,

    -- * Destructuring the Response
    DescribeExportTasksResponse (..),
    newDescribeExportTasksResponse,

    -- * Response Lenses
    describeExportTasksResponse_marker,
    describeExportTasksResponse_exportTasks,
    describeExportTasksResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeExportTasks' smart constructor.
data DescribeExportTasks = DescribeExportTasks'
  { -- | The Amazon Resource Name (ARN) of the snapshot exported to Amazon S3.
    DescribeExportTasks -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
    -- | Filters specify one or more snapshot exports to describe. The filters
    -- are specified as name-value pairs that define what to include in the
    -- output. Filter names and values are case-sensitive.
    --
    -- Supported filters include the following:
    --
    -- -   @export-task-identifier@ - An identifier for the snapshot export
    --     task.
    --
    -- -   @s3-bucket@ - The Amazon S3 bucket the snapshot is exported to.
    --
    -- -   @source-arn@ - The Amazon Resource Name (ARN) of the snapshot
    --     exported to Amazon S3
    --
    -- -   @status@ - The status of the export task. Must be lowercase, for
    --     example, @complete@.
    DescribeExportTasks -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An optional pagination token provided by a previous
    -- @DescribeExportTasks@ request. If you specify this parameter, the
    -- response includes only records beyond the marker, up to the value
    -- specified by the @MaxRecords@ parameter.
    DescribeExportTasks -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the snapshot export task to be described.
    DescribeExportTasks -> Maybe Text
exportTaskIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified value, a pagination token called a
    -- marker is included in the response. You can use the marker in a later
    -- @DescribeExportTasks@ request to retrieve the remaining results.
    --
    -- Default: 100
    --
    -- Constraints: Minimum 20, maximum 100.
    DescribeExportTasks -> Maybe Natural
maxRecords :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeExportTasks -> DescribeExportTasks -> Bool
(DescribeExportTasks -> DescribeExportTasks -> Bool)
-> (DescribeExportTasks -> DescribeExportTasks -> Bool)
-> Eq DescribeExportTasks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeExportTasks -> DescribeExportTasks -> Bool
$c/= :: DescribeExportTasks -> DescribeExportTasks -> Bool
== :: DescribeExportTasks -> DescribeExportTasks -> Bool
$c== :: DescribeExportTasks -> DescribeExportTasks -> Bool
Prelude.Eq, ReadPrec [DescribeExportTasks]
ReadPrec DescribeExportTasks
Int -> ReadS DescribeExportTasks
ReadS [DescribeExportTasks]
(Int -> ReadS DescribeExportTasks)
-> ReadS [DescribeExportTasks]
-> ReadPrec DescribeExportTasks
-> ReadPrec [DescribeExportTasks]
-> Read DescribeExportTasks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeExportTasks]
$creadListPrec :: ReadPrec [DescribeExportTasks]
readPrec :: ReadPrec DescribeExportTasks
$creadPrec :: ReadPrec DescribeExportTasks
readList :: ReadS [DescribeExportTasks]
$creadList :: ReadS [DescribeExportTasks]
readsPrec :: Int -> ReadS DescribeExportTasks
$creadsPrec :: Int -> ReadS DescribeExportTasks
Prelude.Read, Int -> DescribeExportTasks -> ShowS
[DescribeExportTasks] -> ShowS
DescribeExportTasks -> String
(Int -> DescribeExportTasks -> ShowS)
-> (DescribeExportTasks -> String)
-> ([DescribeExportTasks] -> ShowS)
-> Show DescribeExportTasks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeExportTasks] -> ShowS
$cshowList :: [DescribeExportTasks] -> ShowS
show :: DescribeExportTasks -> String
$cshow :: DescribeExportTasks -> String
showsPrec :: Int -> DescribeExportTasks -> ShowS
$cshowsPrec :: Int -> DescribeExportTasks -> ShowS
Prelude.Show, (forall x. DescribeExportTasks -> Rep DescribeExportTasks x)
-> (forall x. Rep DescribeExportTasks x -> DescribeExportTasks)
-> Generic DescribeExportTasks
forall x. Rep DescribeExportTasks x -> DescribeExportTasks
forall x. DescribeExportTasks -> Rep DescribeExportTasks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeExportTasks x -> DescribeExportTasks
$cfrom :: forall x. DescribeExportTasks -> Rep DescribeExportTasks x
Prelude.Generic)

-- |
-- Create a value of 'DescribeExportTasks' 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:
--
-- 'sourceArn', 'describeExportTasks_sourceArn' - The Amazon Resource Name (ARN) of the snapshot exported to Amazon S3.
--
-- 'filters', 'describeExportTasks_filters' - Filters specify one or more snapshot exports to describe. The filters
-- are specified as name-value pairs that define what to include in the
-- output. Filter names and values are case-sensitive.
--
-- Supported filters include the following:
--
-- -   @export-task-identifier@ - An identifier for the snapshot export
--     task.
--
-- -   @s3-bucket@ - The Amazon S3 bucket the snapshot is exported to.
--
-- -   @source-arn@ - The Amazon Resource Name (ARN) of the snapshot
--     exported to Amazon S3
--
-- -   @status@ - The status of the export task. Must be lowercase, for
--     example, @complete@.
--
-- 'marker', 'describeExportTasks_marker' - An optional pagination token provided by a previous
-- @DescribeExportTasks@ request. If you specify this parameter, the
-- response includes only records beyond the marker, up to the value
-- specified by the @MaxRecords@ parameter.
--
-- 'exportTaskIdentifier', 'describeExportTasks_exportTaskIdentifier' - The identifier of the snapshot export task to be described.
--
-- 'maxRecords', 'describeExportTasks_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified value, a pagination token called a
-- marker is included in the response. You can use the marker in a later
-- @DescribeExportTasks@ request to retrieve the remaining results.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
newDescribeExportTasks ::
  DescribeExportTasks
newDescribeExportTasks :: DescribeExportTasks
newDescribeExportTasks =
  DescribeExportTasks' :: Maybe Text
-> Maybe [Filter]
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> DescribeExportTasks
DescribeExportTasks'
    { $sel:sourceArn:DescribeExportTasks' :: Maybe Text
sourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeExportTasks' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeExportTasks' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exportTaskIdentifier:DescribeExportTasks' :: Maybe Text
exportTaskIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeExportTasks' :: Maybe Natural
maxRecords = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the snapshot exported to Amazon S3.
describeExportTasks_sourceArn :: Lens.Lens' DescribeExportTasks (Prelude.Maybe Prelude.Text)
describeExportTasks_sourceArn :: (Maybe Text -> f (Maybe Text))
-> DescribeExportTasks -> f DescribeExportTasks
describeExportTasks_sourceArn = (DescribeExportTasks -> Maybe Text)
-> (DescribeExportTasks -> Maybe Text -> DescribeExportTasks)
-> Lens
     DescribeExportTasks DescribeExportTasks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportTasks' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:DescribeExportTasks' :: DescribeExportTasks -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: DescribeExportTasks
s@DescribeExportTasks' {} Maybe Text
a -> DescribeExportTasks
s {$sel:sourceArn:DescribeExportTasks' :: Maybe Text
sourceArn = Maybe Text
a} :: DescribeExportTasks)

-- | Filters specify one or more snapshot exports to describe. The filters
-- are specified as name-value pairs that define what to include in the
-- output. Filter names and values are case-sensitive.
--
-- Supported filters include the following:
--
-- -   @export-task-identifier@ - An identifier for the snapshot export
--     task.
--
-- -   @s3-bucket@ - The Amazon S3 bucket the snapshot is exported to.
--
-- -   @source-arn@ - The Amazon Resource Name (ARN) of the snapshot
--     exported to Amazon S3
--
-- -   @status@ - The status of the export task. Must be lowercase, for
--     example, @complete@.
describeExportTasks_filters :: Lens.Lens' DescribeExportTasks (Prelude.Maybe [Filter])
describeExportTasks_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeExportTasks -> f DescribeExportTasks
describeExportTasks_filters = (DescribeExportTasks -> Maybe [Filter])
-> (DescribeExportTasks -> Maybe [Filter] -> DescribeExportTasks)
-> Lens
     DescribeExportTasks
     DescribeExportTasks
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportTasks' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeExportTasks' :: DescribeExportTasks -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeExportTasks
s@DescribeExportTasks' {} Maybe [Filter]
a -> DescribeExportTasks
s {$sel:filters:DescribeExportTasks' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeExportTasks) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeExportTasks -> f DescribeExportTasks)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeExportTasks
-> f DescribeExportTasks
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional pagination token provided by a previous
-- @DescribeExportTasks@ request. If you specify this parameter, the
-- response includes only records beyond the marker, up to the value
-- specified by the @MaxRecords@ parameter.
describeExportTasks_marker :: Lens.Lens' DescribeExportTasks (Prelude.Maybe Prelude.Text)
describeExportTasks_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeExportTasks -> f DescribeExportTasks
describeExportTasks_marker = (DescribeExportTasks -> Maybe Text)
-> (DescribeExportTasks -> Maybe Text -> DescribeExportTasks)
-> Lens
     DescribeExportTasks DescribeExportTasks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportTasks' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeExportTasks' :: DescribeExportTasks -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeExportTasks
s@DescribeExportTasks' {} Maybe Text
a -> DescribeExportTasks
s {$sel:marker:DescribeExportTasks' :: Maybe Text
marker = Maybe Text
a} :: DescribeExportTasks)

-- | The identifier of the snapshot export task to be described.
describeExportTasks_exportTaskIdentifier :: Lens.Lens' DescribeExportTasks (Prelude.Maybe Prelude.Text)
describeExportTasks_exportTaskIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeExportTasks -> f DescribeExportTasks
describeExportTasks_exportTaskIdentifier = (DescribeExportTasks -> Maybe Text)
-> (DescribeExportTasks -> Maybe Text -> DescribeExportTasks)
-> Lens
     DescribeExportTasks DescribeExportTasks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportTasks' {Maybe Text
exportTaskIdentifier :: Maybe Text
$sel:exportTaskIdentifier:DescribeExportTasks' :: DescribeExportTasks -> Maybe Text
exportTaskIdentifier} -> Maybe Text
exportTaskIdentifier) (\s :: DescribeExportTasks
s@DescribeExportTasks' {} Maybe Text
a -> DescribeExportTasks
s {$sel:exportTaskIdentifier:DescribeExportTasks' :: Maybe Text
exportTaskIdentifier = Maybe Text
a} :: DescribeExportTasks)

-- | The maximum number of records to include in the response. If more
-- records exist than the specified value, a pagination token called a
-- marker is included in the response. You can use the marker in a later
-- @DescribeExportTasks@ request to retrieve the remaining results.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
describeExportTasks_maxRecords :: Lens.Lens' DescribeExportTasks (Prelude.Maybe Prelude.Natural)
describeExportTasks_maxRecords :: (Maybe Natural -> f (Maybe Natural))
-> DescribeExportTasks -> f DescribeExportTasks
describeExportTasks_maxRecords = (DescribeExportTasks -> Maybe Natural)
-> (DescribeExportTasks -> Maybe Natural -> DescribeExportTasks)
-> Lens
     DescribeExportTasks
     DescribeExportTasks
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportTasks' {Maybe Natural
maxRecords :: Maybe Natural
$sel:maxRecords:DescribeExportTasks' :: DescribeExportTasks -> Maybe Natural
maxRecords} -> Maybe Natural
maxRecords) (\s :: DescribeExportTasks
s@DescribeExportTasks' {} Maybe Natural
a -> DescribeExportTasks
s {$sel:maxRecords:DescribeExportTasks' :: Maybe Natural
maxRecords = Maybe Natural
a} :: DescribeExportTasks)

instance Core.AWSPager DescribeExportTasks where
  page :: DescribeExportTasks
-> AWSResponse DescribeExportTasks -> Maybe DescribeExportTasks
page DescribeExportTasks
rq AWSResponse DescribeExportTasks
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeExportTasks
DescribeExportTasksResponse
rs
            DescribeExportTasksResponse
-> Getting (First Text) DescribeExportTasksResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeExportTasksResponse
-> Const (First Text) DescribeExportTasksResponse
Lens' DescribeExportTasksResponse (Maybe Text)
describeExportTasksResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeExportTasksResponse
 -> Const (First Text) DescribeExportTasksResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeExportTasksResponse 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 DescribeExportTasks
forall a. Maybe a
Prelude.Nothing
    | Maybe [ExportTask] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeExportTasks
DescribeExportTasksResponse
rs
            DescribeExportTasksResponse
-> Getting
     (First [ExportTask]) DescribeExportTasksResponse [ExportTask]
-> Maybe [ExportTask]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ExportTask]
 -> Const (First [ExportTask]) (Maybe [ExportTask]))
-> DescribeExportTasksResponse
-> Const (First [ExportTask]) DescribeExportTasksResponse
Lens' DescribeExportTasksResponse (Maybe [ExportTask])
describeExportTasksResponse_exportTasks
              ((Maybe [ExportTask]
  -> Const (First [ExportTask]) (Maybe [ExportTask]))
 -> DescribeExportTasksResponse
 -> Const (First [ExportTask]) DescribeExportTasksResponse)
-> (([ExportTask] -> Const (First [ExportTask]) [ExportTask])
    -> Maybe [ExportTask]
    -> Const (First [ExportTask]) (Maybe [ExportTask]))
-> Getting
     (First [ExportTask]) DescribeExportTasksResponse [ExportTask]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ExportTask] -> Const (First [ExportTask]) [ExportTask])
-> Maybe [ExportTask]
-> Const (First [ExportTask]) (Maybe [ExportTask])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeExportTasks
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeExportTasks -> Maybe DescribeExportTasks
forall a. a -> Maybe a
Prelude.Just (DescribeExportTasks -> Maybe DescribeExportTasks)
-> DescribeExportTasks -> Maybe DescribeExportTasks
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeExportTasks
rq
          DescribeExportTasks
-> (DescribeExportTasks -> DescribeExportTasks)
-> DescribeExportTasks
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeExportTasks -> Identity DescribeExportTasks
Lens
  DescribeExportTasks DescribeExportTasks (Maybe Text) (Maybe Text)
describeExportTasks_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeExportTasks -> Identity DescribeExportTasks)
-> Maybe Text -> DescribeExportTasks -> DescribeExportTasks
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeExportTasks
DescribeExportTasksResponse
rs
          DescribeExportTasksResponse
-> Getting (First Text) DescribeExportTasksResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeExportTasksResponse
-> Const (First Text) DescribeExportTasksResponse
Lens' DescribeExportTasksResponse (Maybe Text)
describeExportTasksResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeExportTasksResponse
 -> Const (First Text) DescribeExportTasksResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeExportTasksResponse 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 DescribeExportTasks where
  type
    AWSResponse DescribeExportTasks =
      DescribeExportTasksResponse
  request :: DescribeExportTasks -> Request DescribeExportTasks
request = Service -> DescribeExportTasks -> Request DescribeExportTasks
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeExportTasks
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeExportTasks)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeExportTasks))
-> Logger
-> Service
-> Proxy DescribeExportTasks
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeExportTasks)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeExportTasksResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [ExportTask] -> Int -> DescribeExportTasksResponse
DescribeExportTasksResponse'
            (Maybe Text
 -> Maybe [ExportTask] -> Int -> DescribeExportTasksResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [ExportTask] -> Int -> DescribeExportTasksResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either
  String (Maybe [ExportTask] -> Int -> DescribeExportTasksResponse)
-> Either String (Maybe [ExportTask])
-> Either String (Int -> DescribeExportTasksResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ExportTasks" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [ExportTask]))
-> Either String (Maybe [ExportTask])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ExportTask])
-> [Node] -> Either String (Maybe [ExportTask])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ExportTask]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"ExportTask")
                        )
            Either String (Int -> DescribeExportTasksResponse)
-> Either String Int -> Either String DescribeExportTasksResponse
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 DescribeExportTasks

instance Prelude.NFData DescribeExportTasks

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

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

instance Core.ToQuery DescribeExportTasks where
  toQuery :: DescribeExportTasks -> QueryString
toQuery DescribeExportTasks' {Maybe Natural
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Natural
exportTaskIdentifier :: Maybe Text
marker :: Maybe Text
filters :: Maybe [Filter]
sourceArn :: Maybe Text
$sel:maxRecords:DescribeExportTasks' :: DescribeExportTasks -> Maybe Natural
$sel:exportTaskIdentifier:DescribeExportTasks' :: DescribeExportTasks -> Maybe Text
$sel:marker:DescribeExportTasks' :: DescribeExportTasks -> Maybe Text
$sel:filters:DescribeExportTasks' :: DescribeExportTasks -> Maybe [Filter]
$sel:sourceArn:DescribeExportTasks' :: DescribeExportTasks -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeExportTasks" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"SourceArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sourceArn,
        ByteString
"Filters"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Filter] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Filter" ([Filter] -> QueryString) -> Maybe [Filter] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"ExportTaskIdentifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
exportTaskIdentifier,
        ByteString
"MaxRecords" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxRecords
      ]

-- | /See:/ 'newDescribeExportTasksResponse' smart constructor.
data DescribeExportTasksResponse = DescribeExportTasksResponse'
  { -- | A pagination token that can be used in a later @DescribeExportTasks@
    -- request. A marker is used for pagination to identify the location to
    -- begin output for the next response of @DescribeExportTasks@.
    DescribeExportTasksResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Information about an export of a snapshot to Amazon S3.
    DescribeExportTasksResponse -> Maybe [ExportTask]
exportTasks :: Prelude.Maybe [ExportTask],
    -- | The response's http status code.
    DescribeExportTasksResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeExportTasksResponse -> DescribeExportTasksResponse -> Bool
(DescribeExportTasksResponse
 -> DescribeExportTasksResponse -> Bool)
-> (DescribeExportTasksResponse
    -> DescribeExportTasksResponse -> Bool)
-> Eq DescribeExportTasksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeExportTasksResponse -> DescribeExportTasksResponse -> Bool
$c/= :: DescribeExportTasksResponse -> DescribeExportTasksResponse -> Bool
== :: DescribeExportTasksResponse -> DescribeExportTasksResponse -> Bool
$c== :: DescribeExportTasksResponse -> DescribeExportTasksResponse -> Bool
Prelude.Eq, ReadPrec [DescribeExportTasksResponse]
ReadPrec DescribeExportTasksResponse
Int -> ReadS DescribeExportTasksResponse
ReadS [DescribeExportTasksResponse]
(Int -> ReadS DescribeExportTasksResponse)
-> ReadS [DescribeExportTasksResponse]
-> ReadPrec DescribeExportTasksResponse
-> ReadPrec [DescribeExportTasksResponse]
-> Read DescribeExportTasksResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeExportTasksResponse]
$creadListPrec :: ReadPrec [DescribeExportTasksResponse]
readPrec :: ReadPrec DescribeExportTasksResponse
$creadPrec :: ReadPrec DescribeExportTasksResponse
readList :: ReadS [DescribeExportTasksResponse]
$creadList :: ReadS [DescribeExportTasksResponse]
readsPrec :: Int -> ReadS DescribeExportTasksResponse
$creadsPrec :: Int -> ReadS DescribeExportTasksResponse
Prelude.Read, Int -> DescribeExportTasksResponse -> ShowS
[DescribeExportTasksResponse] -> ShowS
DescribeExportTasksResponse -> String
(Int -> DescribeExportTasksResponse -> ShowS)
-> (DescribeExportTasksResponse -> String)
-> ([DescribeExportTasksResponse] -> ShowS)
-> Show DescribeExportTasksResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeExportTasksResponse] -> ShowS
$cshowList :: [DescribeExportTasksResponse] -> ShowS
show :: DescribeExportTasksResponse -> String
$cshow :: DescribeExportTasksResponse -> String
showsPrec :: Int -> DescribeExportTasksResponse -> ShowS
$cshowsPrec :: Int -> DescribeExportTasksResponse -> ShowS
Prelude.Show, (forall x.
 DescribeExportTasksResponse -> Rep DescribeExportTasksResponse x)
-> (forall x.
    Rep DescribeExportTasksResponse x -> DescribeExportTasksResponse)
-> Generic DescribeExportTasksResponse
forall x.
Rep DescribeExportTasksResponse x -> DescribeExportTasksResponse
forall x.
DescribeExportTasksResponse -> Rep DescribeExportTasksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeExportTasksResponse x -> DescribeExportTasksResponse
$cfrom :: forall x.
DescribeExportTasksResponse -> Rep DescribeExportTasksResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeExportTasksResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'marker', 'describeExportTasksResponse_marker' - A pagination token that can be used in a later @DescribeExportTasks@
-- request. A marker is used for pagination to identify the location to
-- begin output for the next response of @DescribeExportTasks@.
--
-- 'exportTasks', 'describeExportTasksResponse_exportTasks' - Information about an export of a snapshot to Amazon S3.
--
-- 'httpStatus', 'describeExportTasksResponse_httpStatus' - The response's http status code.
newDescribeExportTasksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeExportTasksResponse
newDescribeExportTasksResponse :: Int -> DescribeExportTasksResponse
newDescribeExportTasksResponse Int
pHttpStatus_ =
  DescribeExportTasksResponse' :: Maybe Text
-> Maybe [ExportTask] -> Int -> DescribeExportTasksResponse
DescribeExportTasksResponse'
    { $sel:marker:DescribeExportTasksResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exportTasks:DescribeExportTasksResponse' :: Maybe [ExportTask]
exportTasks = Maybe [ExportTask]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeExportTasksResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A pagination token that can be used in a later @DescribeExportTasks@
-- request. A marker is used for pagination to identify the location to
-- begin output for the next response of @DescribeExportTasks@.
describeExportTasksResponse_marker :: Lens.Lens' DescribeExportTasksResponse (Prelude.Maybe Prelude.Text)
describeExportTasksResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeExportTasksResponse -> f DescribeExportTasksResponse
describeExportTasksResponse_marker = (DescribeExportTasksResponse -> Maybe Text)
-> (DescribeExportTasksResponse
    -> Maybe Text -> DescribeExportTasksResponse)
-> Lens' DescribeExportTasksResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportTasksResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeExportTasksResponse' :: DescribeExportTasksResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeExportTasksResponse
s@DescribeExportTasksResponse' {} Maybe Text
a -> DescribeExportTasksResponse
s {$sel:marker:DescribeExportTasksResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeExportTasksResponse)

-- | Information about an export of a snapshot to Amazon S3.
describeExportTasksResponse_exportTasks :: Lens.Lens' DescribeExportTasksResponse (Prelude.Maybe [ExportTask])
describeExportTasksResponse_exportTasks :: (Maybe [ExportTask] -> f (Maybe [ExportTask]))
-> DescribeExportTasksResponse -> f DescribeExportTasksResponse
describeExportTasksResponse_exportTasks = (DescribeExportTasksResponse -> Maybe [ExportTask])
-> (DescribeExportTasksResponse
    -> Maybe [ExportTask] -> DescribeExportTasksResponse)
-> Lens' DescribeExportTasksResponse (Maybe [ExportTask])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeExportTasksResponse' {Maybe [ExportTask]
exportTasks :: Maybe [ExportTask]
$sel:exportTasks:DescribeExportTasksResponse' :: DescribeExportTasksResponse -> Maybe [ExportTask]
exportTasks} -> Maybe [ExportTask]
exportTasks) (\s :: DescribeExportTasksResponse
s@DescribeExportTasksResponse' {} Maybe [ExportTask]
a -> DescribeExportTasksResponse
s {$sel:exportTasks:DescribeExportTasksResponse' :: Maybe [ExportTask]
exportTasks = Maybe [ExportTask]
a} :: DescribeExportTasksResponse) ((Maybe [ExportTask] -> f (Maybe [ExportTask]))
 -> DescribeExportTasksResponse -> f DescribeExportTasksResponse)
-> ((Maybe [ExportTask] -> f (Maybe [ExportTask]))
    -> Maybe [ExportTask] -> f (Maybe [ExportTask]))
-> (Maybe [ExportTask] -> f (Maybe [ExportTask]))
-> DescribeExportTasksResponse
-> f DescribeExportTasksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ExportTask] [ExportTask] [ExportTask] [ExportTask]
-> Iso
     (Maybe [ExportTask])
     (Maybe [ExportTask])
     (Maybe [ExportTask])
     (Maybe [ExportTask])
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 [ExportTask] [ExportTask] [ExportTask] [ExportTask]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DescribeExportTasksResponse