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

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

-- | Provides information about the resource settings for a job that exports
-- endpoint definitions to a file. The file can be added directly to an
-- Amazon Simple Storage Service (Amazon S3) bucket by using the Amazon
-- Pinpoint API or downloaded directly to a computer by using the Amazon
-- Pinpoint console.
--
-- /See:/ 'newExportJobResource' smart constructor.
data ExportJobResource = ExportJobResource'
  { -- | The identifier for the segment that the endpoint definitions were
    -- exported from. If this value isn\'t present, Amazon Pinpoint exported
    -- definitions for all the endpoints that are associated with the
    -- application.
    ExportJobResource -> Maybe Text
segmentId :: Prelude.Maybe Prelude.Text,
    -- | The version of the segment that the endpoint definitions were exported
    -- from.
    ExportJobResource -> Maybe Int
segmentVersion :: Prelude.Maybe Prelude.Int,
    -- | The URL of the location in an Amazon Simple Storage Service (Amazon S3)
    -- bucket where the endpoint definitions were exported to. This location is
    -- typically a folder that contains multiple files. The URL should be in
    -- the following format: s3:\/\/bucket-name\/folder-name\/.
    ExportJobResource -> Text
s3UrlPrefix :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
    -- (IAM) role that authorized Amazon Pinpoint to access the Amazon S3
    -- location where the endpoint definitions were exported to.
    ExportJobResource -> Text
roleArn :: Prelude.Text
  }
  deriving (ExportJobResource -> ExportJobResource -> Bool
(ExportJobResource -> ExportJobResource -> Bool)
-> (ExportJobResource -> ExportJobResource -> Bool)
-> Eq ExportJobResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportJobResource -> ExportJobResource -> Bool
$c/= :: ExportJobResource -> ExportJobResource -> Bool
== :: ExportJobResource -> ExportJobResource -> Bool
$c== :: ExportJobResource -> ExportJobResource -> Bool
Prelude.Eq, ReadPrec [ExportJobResource]
ReadPrec ExportJobResource
Int -> ReadS ExportJobResource
ReadS [ExportJobResource]
(Int -> ReadS ExportJobResource)
-> ReadS [ExportJobResource]
-> ReadPrec ExportJobResource
-> ReadPrec [ExportJobResource]
-> Read ExportJobResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportJobResource]
$creadListPrec :: ReadPrec [ExportJobResource]
readPrec :: ReadPrec ExportJobResource
$creadPrec :: ReadPrec ExportJobResource
readList :: ReadS [ExportJobResource]
$creadList :: ReadS [ExportJobResource]
readsPrec :: Int -> ReadS ExportJobResource
$creadsPrec :: Int -> ReadS ExportJobResource
Prelude.Read, Int -> ExportJobResource -> ShowS
[ExportJobResource] -> ShowS
ExportJobResource -> String
(Int -> ExportJobResource -> ShowS)
-> (ExportJobResource -> String)
-> ([ExportJobResource] -> ShowS)
-> Show ExportJobResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportJobResource] -> ShowS
$cshowList :: [ExportJobResource] -> ShowS
show :: ExportJobResource -> String
$cshow :: ExportJobResource -> String
showsPrec :: Int -> ExportJobResource -> ShowS
$cshowsPrec :: Int -> ExportJobResource -> ShowS
Prelude.Show, (forall x. ExportJobResource -> Rep ExportJobResource x)
-> (forall x. Rep ExportJobResource x -> ExportJobResource)
-> Generic ExportJobResource
forall x. Rep ExportJobResource x -> ExportJobResource
forall x. ExportJobResource -> Rep ExportJobResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportJobResource x -> ExportJobResource
$cfrom :: forall x. ExportJobResource -> Rep ExportJobResource x
Prelude.Generic)

-- |
-- Create a value of 'ExportJobResource' 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', 'exportJobResource_segmentId' - The identifier for the segment that the endpoint definitions were
-- exported from. If this value isn\'t present, Amazon Pinpoint exported
-- definitions for all the endpoints that are associated with the
-- application.
--
-- 'segmentVersion', 'exportJobResource_segmentVersion' - The version of the segment that the endpoint definitions were exported
-- from.
--
-- 's3UrlPrefix', 'exportJobResource_s3UrlPrefix' - The URL of the location in an Amazon Simple Storage Service (Amazon S3)
-- bucket where the endpoint definitions were exported 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', 'exportJobResource_roleArn' - The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that authorized Amazon Pinpoint to access the Amazon S3
-- location where the endpoint definitions were exported to.
newExportJobResource ::
  -- | 's3UrlPrefix'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  ExportJobResource
newExportJobResource :: Text -> Text -> ExportJobResource
newExportJobResource Text
pS3UrlPrefix_ Text
pRoleArn_ =
  ExportJobResource' :: Maybe Text -> Maybe Int -> Text -> Text -> ExportJobResource
ExportJobResource'
    { $sel:segmentId:ExportJobResource' :: Maybe Text
segmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:segmentVersion:ExportJobResource' :: Maybe Int
segmentVersion = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:s3UrlPrefix:ExportJobResource' :: Text
s3UrlPrefix = Text
pS3UrlPrefix_,
      $sel:roleArn:ExportJobResource' :: Text
roleArn = Text
pRoleArn_
    }

-- | The identifier for the segment that the endpoint definitions were
-- exported from. If this value isn\'t present, Amazon Pinpoint exported
-- definitions for all the endpoints that are associated with the
-- application.
exportJobResource_segmentId :: Lens.Lens' ExportJobResource (Prelude.Maybe Prelude.Text)
exportJobResource_segmentId :: (Maybe Text -> f (Maybe Text))
-> ExportJobResource -> f ExportJobResource
exportJobResource_segmentId = (ExportJobResource -> Maybe Text)
-> (ExportJobResource -> Maybe Text -> ExportJobResource)
-> Lens
     ExportJobResource ExportJobResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobResource' {Maybe Text
segmentId :: Maybe Text
$sel:segmentId:ExportJobResource' :: ExportJobResource -> Maybe Text
segmentId} -> Maybe Text
segmentId) (\s :: ExportJobResource
s@ExportJobResource' {} Maybe Text
a -> ExportJobResource
s {$sel:segmentId:ExportJobResource' :: Maybe Text
segmentId = Maybe Text
a} :: ExportJobResource)

-- | The version of the segment that the endpoint definitions were exported
-- from.
exportJobResource_segmentVersion :: Lens.Lens' ExportJobResource (Prelude.Maybe Prelude.Int)
exportJobResource_segmentVersion :: (Maybe Int -> f (Maybe Int))
-> ExportJobResource -> f ExportJobResource
exportJobResource_segmentVersion = (ExportJobResource -> Maybe Int)
-> (ExportJobResource -> Maybe Int -> ExportJobResource)
-> Lens ExportJobResource ExportJobResource (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportJobResource' {Maybe Int
segmentVersion :: Maybe Int
$sel:segmentVersion:ExportJobResource' :: ExportJobResource -> Maybe Int
segmentVersion} -> Maybe Int
segmentVersion) (\s :: ExportJobResource
s@ExportJobResource' {} Maybe Int
a -> ExportJobResource
s {$sel:segmentVersion:ExportJobResource' :: Maybe Int
segmentVersion = Maybe Int
a} :: ExportJobResource)

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

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

instance Core.FromJSON ExportJobResource where
  parseJSON :: Value -> Parser ExportJobResource
parseJSON =
    String
-> (Object -> Parser ExportJobResource)
-> Value
-> Parser ExportJobResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExportJobResource"
      ( \Object
x ->
          Maybe Text -> Maybe Int -> Text -> Text -> ExportJobResource
ExportJobResource'
            (Maybe Text -> Maybe Int -> Text -> Text -> ExportJobResource)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Text -> Text -> ExportJobResource)
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
"SegmentId")
            Parser (Maybe Int -> Text -> Text -> ExportJobResource)
-> Parser (Maybe Int) -> Parser (Text -> Text -> ExportJobResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SegmentVersion")
            Parser (Text -> Text -> ExportJobResource)
-> Parser Text -> Parser (Text -> ExportJobResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3UrlPrefix")
            Parser (Text -> ExportJobResource)
-> Parser Text -> Parser ExportJobResource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RoleArn")
      )

instance Prelude.Hashable ExportJobResource

instance Prelude.NFData ExportJobResource