{-# 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.FraudDetector.Types.ExternalEventsDetail
-- 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.FraudDetector.Types.ExternalEventsDetail where

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

-- | Details for the external events data used for model version training.
--
-- /See:/ 'newExternalEventsDetail' smart constructor.
data ExternalEventsDetail = ExternalEventsDetail'
  { -- | The Amazon S3 bucket location for the data.
    ExternalEventsDetail -> Text
dataLocation :: Prelude.Text,
    -- | The ARN of the role that provides Amazon Fraud Detector access to the
    -- data location.
    ExternalEventsDetail -> Text
dataAccessRoleArn :: Prelude.Text
  }
  deriving (ExternalEventsDetail -> ExternalEventsDetail -> Bool
(ExternalEventsDetail -> ExternalEventsDetail -> Bool)
-> (ExternalEventsDetail -> ExternalEventsDetail -> Bool)
-> Eq ExternalEventsDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalEventsDetail -> ExternalEventsDetail -> Bool
$c/= :: ExternalEventsDetail -> ExternalEventsDetail -> Bool
== :: ExternalEventsDetail -> ExternalEventsDetail -> Bool
$c== :: ExternalEventsDetail -> ExternalEventsDetail -> Bool
Prelude.Eq, ReadPrec [ExternalEventsDetail]
ReadPrec ExternalEventsDetail
Int -> ReadS ExternalEventsDetail
ReadS [ExternalEventsDetail]
(Int -> ReadS ExternalEventsDetail)
-> ReadS [ExternalEventsDetail]
-> ReadPrec ExternalEventsDetail
-> ReadPrec [ExternalEventsDetail]
-> Read ExternalEventsDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExternalEventsDetail]
$creadListPrec :: ReadPrec [ExternalEventsDetail]
readPrec :: ReadPrec ExternalEventsDetail
$creadPrec :: ReadPrec ExternalEventsDetail
readList :: ReadS [ExternalEventsDetail]
$creadList :: ReadS [ExternalEventsDetail]
readsPrec :: Int -> ReadS ExternalEventsDetail
$creadsPrec :: Int -> ReadS ExternalEventsDetail
Prelude.Read, Int -> ExternalEventsDetail -> ShowS
[ExternalEventsDetail] -> ShowS
ExternalEventsDetail -> String
(Int -> ExternalEventsDetail -> ShowS)
-> (ExternalEventsDetail -> String)
-> ([ExternalEventsDetail] -> ShowS)
-> Show ExternalEventsDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalEventsDetail] -> ShowS
$cshowList :: [ExternalEventsDetail] -> ShowS
show :: ExternalEventsDetail -> String
$cshow :: ExternalEventsDetail -> String
showsPrec :: Int -> ExternalEventsDetail -> ShowS
$cshowsPrec :: Int -> ExternalEventsDetail -> ShowS
Prelude.Show, (forall x. ExternalEventsDetail -> Rep ExternalEventsDetail x)
-> (forall x. Rep ExternalEventsDetail x -> ExternalEventsDetail)
-> Generic ExternalEventsDetail
forall x. Rep ExternalEventsDetail x -> ExternalEventsDetail
forall x. ExternalEventsDetail -> Rep ExternalEventsDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExternalEventsDetail x -> ExternalEventsDetail
$cfrom :: forall x. ExternalEventsDetail -> Rep ExternalEventsDetail x
Prelude.Generic)

-- |
-- Create a value of 'ExternalEventsDetail' 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:
--
-- 'dataLocation', 'externalEventsDetail_dataLocation' - The Amazon S3 bucket location for the data.
--
-- 'dataAccessRoleArn', 'externalEventsDetail_dataAccessRoleArn' - The ARN of the role that provides Amazon Fraud Detector access to the
-- data location.
newExternalEventsDetail ::
  -- | 'dataLocation'
  Prelude.Text ->
  -- | 'dataAccessRoleArn'
  Prelude.Text ->
  ExternalEventsDetail
newExternalEventsDetail :: Text -> Text -> ExternalEventsDetail
newExternalEventsDetail
  Text
pDataLocation_
  Text
pDataAccessRoleArn_ =
    ExternalEventsDetail' :: Text -> Text -> ExternalEventsDetail
ExternalEventsDetail'
      { $sel:dataLocation:ExternalEventsDetail' :: Text
dataLocation =
          Text
pDataLocation_,
        $sel:dataAccessRoleArn:ExternalEventsDetail' :: Text
dataAccessRoleArn = Text
pDataAccessRoleArn_
      }

-- | The Amazon S3 bucket location for the data.
externalEventsDetail_dataLocation :: Lens.Lens' ExternalEventsDetail Prelude.Text
externalEventsDetail_dataLocation :: (Text -> f Text) -> ExternalEventsDetail -> f ExternalEventsDetail
externalEventsDetail_dataLocation = (ExternalEventsDetail -> Text)
-> (ExternalEventsDetail -> Text -> ExternalEventsDetail)
-> Lens ExternalEventsDetail ExternalEventsDetail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalEventsDetail' {Text
dataLocation :: Text
$sel:dataLocation:ExternalEventsDetail' :: ExternalEventsDetail -> Text
dataLocation} -> Text
dataLocation) (\s :: ExternalEventsDetail
s@ExternalEventsDetail' {} Text
a -> ExternalEventsDetail
s {$sel:dataLocation:ExternalEventsDetail' :: Text
dataLocation = Text
a} :: ExternalEventsDetail)

-- | The ARN of the role that provides Amazon Fraud Detector access to the
-- data location.
externalEventsDetail_dataAccessRoleArn :: Lens.Lens' ExternalEventsDetail Prelude.Text
externalEventsDetail_dataAccessRoleArn :: (Text -> f Text) -> ExternalEventsDetail -> f ExternalEventsDetail
externalEventsDetail_dataAccessRoleArn = (ExternalEventsDetail -> Text)
-> (ExternalEventsDetail -> Text -> ExternalEventsDetail)
-> Lens ExternalEventsDetail ExternalEventsDetail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalEventsDetail' {Text
dataAccessRoleArn :: Text
$sel:dataAccessRoleArn:ExternalEventsDetail' :: ExternalEventsDetail -> Text
dataAccessRoleArn} -> Text
dataAccessRoleArn) (\s :: ExternalEventsDetail
s@ExternalEventsDetail' {} Text
a -> ExternalEventsDetail
s {$sel:dataAccessRoleArn:ExternalEventsDetail' :: Text
dataAccessRoleArn = Text
a} :: ExternalEventsDetail)

instance Core.FromJSON ExternalEventsDetail where
  parseJSON :: Value -> Parser ExternalEventsDetail
parseJSON =
    String
-> (Object -> Parser ExternalEventsDetail)
-> Value
-> Parser ExternalEventsDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExternalEventsDetail"
      ( \Object
x ->
          Text -> Text -> ExternalEventsDetail
ExternalEventsDetail'
            (Text -> Text -> ExternalEventsDetail)
-> Parser Text -> Parser (Text -> ExternalEventsDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"dataLocation")
            Parser (Text -> ExternalEventsDetail)
-> Parser Text -> Parser ExternalEventsDetail
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
"dataAccessRoleArn")
      )

instance Prelude.Hashable ExternalEventsDetail

instance Prelude.NFData ExternalEventsDetail

instance Core.ToJSON ExternalEventsDetail where
  toJSON :: ExternalEventsDetail -> Value
toJSON ExternalEventsDetail' {Text
dataAccessRoleArn :: Text
dataLocation :: Text
$sel:dataAccessRoleArn:ExternalEventsDetail' :: ExternalEventsDetail -> Text
$sel:dataLocation:ExternalEventsDetail' :: ExternalEventsDetail -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dataLocation" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataLocation),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"dataAccessRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataAccessRoleArn)
          ]
      )