{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Pinpoint.Types.ExportJobsResponse
-- 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)
module Amazonka.Pinpoint.Types.ExportJobsResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.ExportJobResponse
import qualified Amazonka.Prelude as Prelude

-- | Provides information about all the export jobs that are associated with
-- an application or segment. An export job is a job that exports endpoint
-- definitions to a file.
--
-- /See:/ 'newExportJobsResponse' smart constructor.
data ExportJobsResponse = ExportJobsResponse'
  { -- | The string to use in a subsequent request to get the next page of
    -- results in a paginated response. This value is null if there are no
    -- additional pages.
    ExportJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of responses, one for each export job that\'s associated with
    -- the application (Export Jobs resource) or segment (Segment Export Jobs
    -- resource).
    ExportJobsResponse -> [ExportJobResponse]
item :: [ExportJobResponse]
  }
  deriving (ExportJobsResponse -> ExportJobsResponse -> Bool
(ExportJobsResponse -> ExportJobsResponse -> Bool)
-> (ExportJobsResponse -> ExportJobsResponse -> Bool)
-> Eq ExportJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportJobsResponse -> ExportJobsResponse -> Bool
$c/= :: ExportJobsResponse -> ExportJobsResponse -> Bool
== :: ExportJobsResponse -> ExportJobsResponse -> Bool
$c== :: ExportJobsResponse -> ExportJobsResponse -> Bool
Prelude.Eq, ReadPrec [ExportJobsResponse]
ReadPrec ExportJobsResponse
Int -> ReadS ExportJobsResponse
ReadS [ExportJobsResponse]
(Int -> ReadS ExportJobsResponse)
-> ReadS [ExportJobsResponse]
-> ReadPrec ExportJobsResponse
-> ReadPrec [ExportJobsResponse]
-> Read ExportJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportJobsResponse]
$creadListPrec :: ReadPrec [ExportJobsResponse]
readPrec :: ReadPrec ExportJobsResponse
$creadPrec :: ReadPrec ExportJobsResponse
readList :: ReadS [ExportJobsResponse]
$creadList :: ReadS [ExportJobsResponse]
readsPrec :: Int -> ReadS ExportJobsResponse
$creadsPrec :: Int -> ReadS ExportJobsResponse
Prelude.Read, Int -> ExportJobsResponse -> ShowS
[ExportJobsResponse] -> ShowS
ExportJobsResponse -> String
(Int -> ExportJobsResponse -> ShowS)
-> (ExportJobsResponse -> String)
-> ([ExportJobsResponse] -> ShowS)
-> Show ExportJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportJobsResponse] -> ShowS
$cshowList :: [ExportJobsResponse] -> ShowS
show :: ExportJobsResponse -> String
$cshow :: ExportJobsResponse -> String
showsPrec :: Int -> ExportJobsResponse -> ShowS
$cshowsPrec :: Int -> ExportJobsResponse -> ShowS
Prelude.Show, (forall x. ExportJobsResponse -> Rep ExportJobsResponse x)
-> (forall x. Rep ExportJobsResponse x -> ExportJobsResponse)
-> Generic ExportJobsResponse
forall x. Rep ExportJobsResponse x -> ExportJobsResponse
forall x. ExportJobsResponse -> Rep ExportJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportJobsResponse x -> ExportJobsResponse
$cfrom :: forall x. ExportJobsResponse -> Rep ExportJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ExportJobsResponse' 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', 'exportJobsResponse_nextToken' - The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
--
-- 'item', 'exportJobsResponse_item' - An array of responses, one for each export job that\'s associated with
-- the application (Export Jobs resource) or segment (Segment Export Jobs
-- resource).
newExportJobsResponse ::
  ExportJobsResponse
newExportJobsResponse :: ExportJobsResponse
newExportJobsResponse =
  ExportJobsResponse' :: Maybe Text -> [ExportJobResponse] -> ExportJobsResponse
ExportJobsResponse'
    { $sel:nextToken:ExportJobsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:item:ExportJobsResponse' :: [ExportJobResponse]
item = [ExportJobResponse]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
exportJobsResponse_nextToken :: Lens.Lens' ExportJobsResponse (Prelude.Maybe Prelude.Text)
exportJobsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ExportJobsResponse -> f ExportJobsResponse
exportJobsResponse_nextToken = (ExportJobsResponse -> Maybe Text)
-> (ExportJobsResponse -> Maybe Text -> ExportJobsResponse)
-> Lens
     ExportJobsResponse ExportJobsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ExportJobsResponse' :: ExportJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ExportJobsResponse
s@ExportJobsResponse' {} Maybe Text
a -> ExportJobsResponse
s {$sel:nextToken:ExportJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ExportJobsResponse)

-- | An array of responses, one for each export job that\'s associated with
-- the application (Export Jobs resource) or segment (Segment Export Jobs
-- resource).
exportJobsResponse_item :: Lens.Lens' ExportJobsResponse [ExportJobResponse]
exportJobsResponse_item :: ([ExportJobResponse] -> f [ExportJobResponse])
-> ExportJobsResponse -> f ExportJobsResponse
exportJobsResponse_item = (ExportJobsResponse -> [ExportJobResponse])
-> (ExportJobsResponse
    -> [ExportJobResponse] -> ExportJobsResponse)
-> Lens
     ExportJobsResponse
     ExportJobsResponse
     [ExportJobResponse]
     [ExportJobResponse]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobsResponse' {[ExportJobResponse]
item :: [ExportJobResponse]
$sel:item:ExportJobsResponse' :: ExportJobsResponse -> [ExportJobResponse]
item} -> [ExportJobResponse]
item) (\s :: ExportJobsResponse
s@ExportJobsResponse' {} [ExportJobResponse]
a -> ExportJobsResponse
s {$sel:item:ExportJobsResponse' :: [ExportJobResponse]
item = [ExportJobResponse]
a} :: ExportJobsResponse) (([ExportJobResponse] -> f [ExportJobResponse])
 -> ExportJobsResponse -> f ExportJobsResponse)
-> (([ExportJobResponse] -> f [ExportJobResponse])
    -> [ExportJobResponse] -> f [ExportJobResponse])
-> ([ExportJobResponse] -> f [ExportJobResponse])
-> ExportJobsResponse
-> f ExportJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ExportJobResponse] -> f [ExportJobResponse])
-> [ExportJobResponse] -> f [ExportJobResponse]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ExportJobsResponse where
  parseJSON :: Value -> Parser ExportJobsResponse
parseJSON =
    String
-> (Object -> Parser ExportJobsResponse)
-> Value
-> Parser ExportJobsResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExportJobsResponse"
      ( \Object
x ->
          Maybe Text -> [ExportJobResponse] -> ExportJobsResponse
ExportJobsResponse'
            (Maybe Text -> [ExportJobResponse] -> ExportJobsResponse)
-> Parser (Maybe Text)
-> Parser ([ExportJobResponse] -> ExportJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NextToken")
            Parser ([ExportJobResponse] -> ExportJobsResponse)
-> Parser [ExportJobResponse] -> Parser ExportJobsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [ExportJobResponse])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Item" Parser (Maybe [ExportJobResponse])
-> [ExportJobResponse] -> Parser [ExportJobResponse]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ExportJobResponse]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ExportJobsResponse

instance Prelude.NFData ExportJobsResponse