{-# 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.ExportJobRequest
-- 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.ExportJobRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the settings for a job that exports endpoint definitions to an
-- Amazon Simple Storage Service (Amazon S3) bucket.
--
-- /See:/ 'newExportJobRequest' smart constructor.
data ExportJobRequest = ExportJobRequest'
  { -- | The identifier for the segment to export endpoint definitions from. If
    -- you don\'t specify this value, Amazon Pinpoint exports definitions for
    -- all the endpoints that are associated with the application.
    ExportJobRequest -> Maybe Text
segmentId :: Prelude.Maybe Prelude.Text,
    -- | The version of the segment to export endpoint definitions from, if
    -- specified.
    ExportJobRequest -> Maybe Int
segmentVersion :: Prelude.Maybe Prelude.Int,
    -- | The URL of the location in an Amazon Simple Storage Service (Amazon S3)
    -- bucket where you want to export endpoint definitions to. This location
    -- is typically a folder that contains multiple files. The URL should be in
    -- the following format: s3:\/\/bucket-name\/folder-name\/.
    ExportJobRequest -> Text
s3UrlPrefix :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
    -- (IAM) role that authorizes Amazon Pinpoint to access the Amazon S3
    -- location where you want to export endpoint definitions to.
    ExportJobRequest -> Text
roleArn :: Prelude.Text
  }
  deriving (ExportJobRequest -> ExportJobRequest -> Bool
(ExportJobRequest -> ExportJobRequest -> Bool)
-> (ExportJobRequest -> ExportJobRequest -> Bool)
-> Eq ExportJobRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportJobRequest -> ExportJobRequest -> Bool
$c/= :: ExportJobRequest -> ExportJobRequest -> Bool
== :: ExportJobRequest -> ExportJobRequest -> Bool
$c== :: ExportJobRequest -> ExportJobRequest -> Bool
Prelude.Eq, ReadPrec [ExportJobRequest]
ReadPrec ExportJobRequest
Int -> ReadS ExportJobRequest
ReadS [ExportJobRequest]
(Int -> ReadS ExportJobRequest)
-> ReadS [ExportJobRequest]
-> ReadPrec ExportJobRequest
-> ReadPrec [ExportJobRequest]
-> Read ExportJobRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportJobRequest]
$creadListPrec :: ReadPrec [ExportJobRequest]
readPrec :: ReadPrec ExportJobRequest
$creadPrec :: ReadPrec ExportJobRequest
readList :: ReadS [ExportJobRequest]
$creadList :: ReadS [ExportJobRequest]
readsPrec :: Int -> ReadS ExportJobRequest
$creadsPrec :: Int -> ReadS ExportJobRequest
Prelude.Read, Int -> ExportJobRequest -> ShowS
[ExportJobRequest] -> ShowS
ExportJobRequest -> String
(Int -> ExportJobRequest -> ShowS)
-> (ExportJobRequest -> String)
-> ([ExportJobRequest] -> ShowS)
-> Show ExportJobRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportJobRequest] -> ShowS
$cshowList :: [ExportJobRequest] -> ShowS
show :: ExportJobRequest -> String
$cshow :: ExportJobRequest -> String
showsPrec :: Int -> ExportJobRequest -> ShowS
$cshowsPrec :: Int -> ExportJobRequest -> ShowS
Prelude.Show, (forall x. ExportJobRequest -> Rep ExportJobRequest x)
-> (forall x. Rep ExportJobRequest x -> ExportJobRequest)
-> Generic ExportJobRequest
forall x. Rep ExportJobRequest x -> ExportJobRequest
forall x. ExportJobRequest -> Rep ExportJobRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportJobRequest x -> ExportJobRequest
$cfrom :: forall x. ExportJobRequest -> Rep ExportJobRequest x
Prelude.Generic)

-- |
-- Create a value of 'ExportJobRequest' 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:
--
-- 'segmentId', 'exportJobRequest_segmentId' - The identifier for the segment to export endpoint definitions from. If
-- you don\'t specify this value, Amazon Pinpoint exports definitions for
-- all the endpoints that are associated with the application.
--
-- 'segmentVersion', 'exportJobRequest_segmentVersion' - The version of the segment to export endpoint definitions from, if
-- specified.
--
-- 's3UrlPrefix', 'exportJobRequest_s3UrlPrefix' - The URL of the location in an Amazon Simple Storage Service (Amazon S3)
-- bucket where you want to export endpoint definitions to. This location
-- is typically a folder that contains multiple files. The URL should be in
-- the following format: s3:\/\/bucket-name\/folder-name\/.
--
-- 'roleArn', 'exportJobRequest_roleArn' - The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that authorizes Amazon Pinpoint to access the Amazon S3
-- location where you want to export endpoint definitions to.
newExportJobRequest ::
  -- | 's3UrlPrefix'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  ExportJobRequest
newExportJobRequest :: Text -> Text -> ExportJobRequest
newExportJobRequest Text
pS3UrlPrefix_ Text
pRoleArn_ =
  ExportJobRequest' :: Maybe Text -> Maybe Int -> Text -> Text -> ExportJobRequest
ExportJobRequest'
    { $sel:segmentId:ExportJobRequest' :: Maybe Text
segmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:segmentVersion:ExportJobRequest' :: Maybe Int
segmentVersion = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:s3UrlPrefix:ExportJobRequest' :: Text
s3UrlPrefix = Text
pS3UrlPrefix_,
      $sel:roleArn:ExportJobRequest' :: Text
roleArn = Text
pRoleArn_
    }

-- | The identifier for the segment to export endpoint definitions from. If
-- you don\'t specify this value, Amazon Pinpoint exports definitions for
-- all the endpoints that are associated with the application.
exportJobRequest_segmentId :: Lens.Lens' ExportJobRequest (Prelude.Maybe Prelude.Text)
exportJobRequest_segmentId :: (Maybe Text -> f (Maybe Text))
-> ExportJobRequest -> f ExportJobRequest
exportJobRequest_segmentId = (ExportJobRequest -> Maybe Text)
-> (ExportJobRequest -> Maybe Text -> ExportJobRequest)
-> Lens ExportJobRequest ExportJobRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobRequest' {Maybe Text
segmentId :: Maybe Text
$sel:segmentId:ExportJobRequest' :: ExportJobRequest -> Maybe Text
segmentId} -> Maybe Text
segmentId) (\s :: ExportJobRequest
s@ExportJobRequest' {} Maybe Text
a -> ExportJobRequest
s {$sel:segmentId:ExportJobRequest' :: Maybe Text
segmentId = Maybe Text
a} :: ExportJobRequest)

-- | The version of the segment to export endpoint definitions from, if
-- specified.
exportJobRequest_segmentVersion :: Lens.Lens' ExportJobRequest (Prelude.Maybe Prelude.Int)
exportJobRequest_segmentVersion :: (Maybe Int -> f (Maybe Int))
-> ExportJobRequest -> f ExportJobRequest
exportJobRequest_segmentVersion = (ExportJobRequest -> Maybe Int)
-> (ExportJobRequest -> Maybe Int -> ExportJobRequest)
-> Lens ExportJobRequest ExportJobRequest (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobRequest' {Maybe Int
segmentVersion :: Maybe Int
$sel:segmentVersion:ExportJobRequest' :: ExportJobRequest -> Maybe Int
segmentVersion} -> Maybe Int
segmentVersion) (\s :: ExportJobRequest
s@ExportJobRequest' {} Maybe Int
a -> ExportJobRequest
s {$sel:segmentVersion:ExportJobRequest' :: Maybe Int
segmentVersion = Maybe Int
a} :: ExportJobRequest)

-- | The URL of the location in an Amazon Simple Storage Service (Amazon S3)
-- bucket where you want to export endpoint definitions to. This location
-- is typically a folder that contains multiple files. The URL should be in
-- the following format: s3:\/\/bucket-name\/folder-name\/.
exportJobRequest_s3UrlPrefix :: Lens.Lens' ExportJobRequest Prelude.Text
exportJobRequest_s3UrlPrefix :: (Text -> f Text) -> ExportJobRequest -> f ExportJobRequest
exportJobRequest_s3UrlPrefix = (ExportJobRequest -> Text)
-> (ExportJobRequest -> Text -> ExportJobRequest)
-> Lens ExportJobRequest ExportJobRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobRequest' {Text
s3UrlPrefix :: Text
$sel:s3UrlPrefix:ExportJobRequest' :: ExportJobRequest -> Text
s3UrlPrefix} -> Text
s3UrlPrefix) (\s :: ExportJobRequest
s@ExportJobRequest' {} Text
a -> ExportJobRequest
s {$sel:s3UrlPrefix:ExportJobRequest' :: Text
s3UrlPrefix = Text
a} :: ExportJobRequest)

-- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that authorizes Amazon Pinpoint to access the Amazon S3
-- location where you want to export endpoint definitions to.
exportJobRequest_roleArn :: Lens.Lens' ExportJobRequest Prelude.Text
exportJobRequest_roleArn :: (Text -> f Text) -> ExportJobRequest -> f ExportJobRequest
exportJobRequest_roleArn = (ExportJobRequest -> Text)
-> (ExportJobRequest -> Text -> ExportJobRequest)
-> Lens ExportJobRequest ExportJobRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobRequest' {Text
roleArn :: Text
$sel:roleArn:ExportJobRequest' :: ExportJobRequest -> Text
roleArn} -> Text
roleArn) (\s :: ExportJobRequest
s@ExportJobRequest' {} Text
a -> ExportJobRequest
s {$sel:roleArn:ExportJobRequest' :: Text
roleArn = Text
a} :: ExportJobRequest)

instance Prelude.Hashable ExportJobRequest

instance Prelude.NFData ExportJobRequest

instance Core.ToJSON ExportJobRequest where
  toJSON :: ExportJobRequest -> Value
toJSON ExportJobRequest' {Maybe Int
Maybe Text
Text
roleArn :: Text
s3UrlPrefix :: Text
segmentVersion :: Maybe Int
segmentId :: Maybe Text
$sel:roleArn:ExportJobRequest' :: ExportJobRequest -> Text
$sel:s3UrlPrefix:ExportJobRequest' :: ExportJobRequest -> Text
$sel:segmentVersion:ExportJobRequest' :: ExportJobRequest -> Maybe Int
$sel:segmentId:ExportJobRequest' :: ExportJobRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SegmentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
segmentId,
            (Text
"SegmentVersion" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
segmentVersion,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3UrlPrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3UrlPrefix),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
          ]
      )