{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Pinpoint.Types.ExportJobResource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:segmentId:ExportJobResource' :: Maybe Text
segmentId = forall a. Maybe a
Prelude.Nothing,
      $sel:segmentVersion:ExportJobResource' :: Maybe Int
segmentVersion = 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 :: Lens' ExportJobResource (Maybe Text)
exportJobResource_segmentId = 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 :: Lens' ExportJobResource (Maybe Int)
exportJobResource_segmentVersion = 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 :: Lens' ExportJobResource Text
exportJobResource_s3UrlPrefix = 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 :: Lens' ExportJobResource Text
exportJobResource_roleArn = 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 Data.FromJSON ExportJobResource where
  parseJSON :: Value -> Parser ExportJobResource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExportJobResource"
      ( \Object
x ->
          Maybe Text -> Maybe Int -> Text -> Text -> ExportJobResource
ExportJobResource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SegmentId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SegmentVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3UrlPrefix")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"RoleArn")
      )

instance Prelude.Hashable ExportJobResource where
  hashWithSalt :: Int -> ExportJobResource -> Int
hashWithSalt Int
_salt ExportJobResource' {Maybe Int
Maybe Text
Text
roleArn :: Text
s3UrlPrefix :: Text
segmentVersion :: Maybe Int
segmentId :: Maybe Text
$sel:roleArn:ExportJobResource' :: ExportJobResource -> Text
$sel:s3UrlPrefix:ExportJobResource' :: ExportJobResource -> Text
$sel:segmentVersion:ExportJobResource' :: ExportJobResource -> Maybe Int
$sel:segmentId:ExportJobResource' :: ExportJobResource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
segmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
segmentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3UrlPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn

instance Prelude.NFData ExportJobResource where
  rnf :: ExportJobResource -> ()
rnf ExportJobResource' {Maybe Int
Maybe Text
Text
roleArn :: Text
s3UrlPrefix :: Text
segmentVersion :: Maybe Int
segmentId :: Maybe Text
$sel:roleArn:ExportJobResource' :: ExportJobResource -> Text
$sel:s3UrlPrefix:ExportJobResource' :: ExportJobResource -> Text
$sel:segmentVersion:ExportJobResource' :: ExportJobResource -> Maybe Int
$sel:segmentId:ExportJobResource' :: ExportJobResource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
segmentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
segmentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3UrlPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn