{-# 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.AppFlow.Types.RedshiftConnectorProfileProperties
-- 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.AppFlow.Types.RedshiftConnectorProfileProperties where

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

-- | The connector-specific profile properties when using Amazon Redshift.
--
-- /See:/ 'newRedshiftConnectorProfileProperties' smart constructor.
data RedshiftConnectorProfileProperties = RedshiftConnectorProfileProperties'
  { -- | The object key for the destination bucket in which Amazon AppFlow places
    -- the files.
    RedshiftConnectorProfileProperties -> Maybe Text
bucketPrefix :: Prelude.Maybe Prelude.Text,
    -- | The JDBC URL of the Amazon Redshift cluster.
    RedshiftConnectorProfileProperties -> Text
databaseUrl :: Prelude.Text,
    -- | A name for the associated Amazon S3 bucket.
    RedshiftConnectorProfileProperties -> Text
bucketName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role.
    RedshiftConnectorProfileProperties -> Text
roleArn :: Prelude.Text
  }
  deriving (RedshiftConnectorProfileProperties
-> RedshiftConnectorProfileProperties -> Bool
(RedshiftConnectorProfileProperties
 -> RedshiftConnectorProfileProperties -> Bool)
-> (RedshiftConnectorProfileProperties
    -> RedshiftConnectorProfileProperties -> Bool)
-> Eq RedshiftConnectorProfileProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RedshiftConnectorProfileProperties
-> RedshiftConnectorProfileProperties -> Bool
$c/= :: RedshiftConnectorProfileProperties
-> RedshiftConnectorProfileProperties -> Bool
== :: RedshiftConnectorProfileProperties
-> RedshiftConnectorProfileProperties -> Bool
$c== :: RedshiftConnectorProfileProperties
-> RedshiftConnectorProfileProperties -> Bool
Prelude.Eq, ReadPrec [RedshiftConnectorProfileProperties]
ReadPrec RedshiftConnectorProfileProperties
Int -> ReadS RedshiftConnectorProfileProperties
ReadS [RedshiftConnectorProfileProperties]
(Int -> ReadS RedshiftConnectorProfileProperties)
-> ReadS [RedshiftConnectorProfileProperties]
-> ReadPrec RedshiftConnectorProfileProperties
-> ReadPrec [RedshiftConnectorProfileProperties]
-> Read RedshiftConnectorProfileProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RedshiftConnectorProfileProperties]
$creadListPrec :: ReadPrec [RedshiftConnectorProfileProperties]
readPrec :: ReadPrec RedshiftConnectorProfileProperties
$creadPrec :: ReadPrec RedshiftConnectorProfileProperties
readList :: ReadS [RedshiftConnectorProfileProperties]
$creadList :: ReadS [RedshiftConnectorProfileProperties]
readsPrec :: Int -> ReadS RedshiftConnectorProfileProperties
$creadsPrec :: Int -> ReadS RedshiftConnectorProfileProperties
Prelude.Read, Int -> RedshiftConnectorProfileProperties -> ShowS
[RedshiftConnectorProfileProperties] -> ShowS
RedshiftConnectorProfileProperties -> String
(Int -> RedshiftConnectorProfileProperties -> ShowS)
-> (RedshiftConnectorProfileProperties -> String)
-> ([RedshiftConnectorProfileProperties] -> ShowS)
-> Show RedshiftConnectorProfileProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RedshiftConnectorProfileProperties] -> ShowS
$cshowList :: [RedshiftConnectorProfileProperties] -> ShowS
show :: RedshiftConnectorProfileProperties -> String
$cshow :: RedshiftConnectorProfileProperties -> String
showsPrec :: Int -> RedshiftConnectorProfileProperties -> ShowS
$cshowsPrec :: Int -> RedshiftConnectorProfileProperties -> ShowS
Prelude.Show, (forall x.
 RedshiftConnectorProfileProperties
 -> Rep RedshiftConnectorProfileProperties x)
-> (forall x.
    Rep RedshiftConnectorProfileProperties x
    -> RedshiftConnectorProfileProperties)
-> Generic RedshiftConnectorProfileProperties
forall x.
Rep RedshiftConnectorProfileProperties x
-> RedshiftConnectorProfileProperties
forall x.
RedshiftConnectorProfileProperties
-> Rep RedshiftConnectorProfileProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RedshiftConnectorProfileProperties x
-> RedshiftConnectorProfileProperties
$cfrom :: forall x.
RedshiftConnectorProfileProperties
-> Rep RedshiftConnectorProfileProperties x
Prelude.Generic)

-- |
-- Create a value of 'RedshiftConnectorProfileProperties' 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:
--
-- 'bucketPrefix', 'redshiftConnectorProfileProperties_bucketPrefix' - The object key for the destination bucket in which Amazon AppFlow places
-- the files.
--
-- 'databaseUrl', 'redshiftConnectorProfileProperties_databaseUrl' - The JDBC URL of the Amazon Redshift cluster.
--
-- 'bucketName', 'redshiftConnectorProfileProperties_bucketName' - A name for the associated Amazon S3 bucket.
--
-- 'roleArn', 'redshiftConnectorProfileProperties_roleArn' - The Amazon Resource Name (ARN) of the IAM role.
newRedshiftConnectorProfileProperties ::
  -- | 'databaseUrl'
  Prelude.Text ->
  -- | 'bucketName'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  RedshiftConnectorProfileProperties
newRedshiftConnectorProfileProperties :: Text -> Text -> Text -> RedshiftConnectorProfileProperties
newRedshiftConnectorProfileProperties
  Text
pDatabaseUrl_
  Text
pBucketName_
  Text
pRoleArn_ =
    RedshiftConnectorProfileProperties' :: Maybe Text
-> Text -> Text -> Text -> RedshiftConnectorProfileProperties
RedshiftConnectorProfileProperties'
      { $sel:bucketPrefix:RedshiftConnectorProfileProperties' :: Maybe Text
bucketPrefix =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:databaseUrl:RedshiftConnectorProfileProperties' :: Text
databaseUrl = Text
pDatabaseUrl_,
        $sel:bucketName:RedshiftConnectorProfileProperties' :: Text
bucketName = Text
pBucketName_,
        $sel:roleArn:RedshiftConnectorProfileProperties' :: Text
roleArn = Text
pRoleArn_
      }

-- | The object key for the destination bucket in which Amazon AppFlow places
-- the files.
redshiftConnectorProfileProperties_bucketPrefix :: Lens.Lens' RedshiftConnectorProfileProperties (Prelude.Maybe Prelude.Text)
redshiftConnectorProfileProperties_bucketPrefix :: (Maybe Text -> f (Maybe Text))
-> RedshiftConnectorProfileProperties
-> f RedshiftConnectorProfileProperties
redshiftConnectorProfileProperties_bucketPrefix = (RedshiftConnectorProfileProperties -> Maybe Text)
-> (RedshiftConnectorProfileProperties
    -> Maybe Text -> RedshiftConnectorProfileProperties)
-> Lens
     RedshiftConnectorProfileProperties
     RedshiftConnectorProfileProperties
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftConnectorProfileProperties' {Maybe Text
bucketPrefix :: Maybe Text
$sel:bucketPrefix:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Maybe Text
bucketPrefix} -> Maybe Text
bucketPrefix) (\s :: RedshiftConnectorProfileProperties
s@RedshiftConnectorProfileProperties' {} Maybe Text
a -> RedshiftConnectorProfileProperties
s {$sel:bucketPrefix:RedshiftConnectorProfileProperties' :: Maybe Text
bucketPrefix = Maybe Text
a} :: RedshiftConnectorProfileProperties)

-- | The JDBC URL of the Amazon Redshift cluster.
redshiftConnectorProfileProperties_databaseUrl :: Lens.Lens' RedshiftConnectorProfileProperties Prelude.Text
redshiftConnectorProfileProperties_databaseUrl :: (Text -> f Text)
-> RedshiftConnectorProfileProperties
-> f RedshiftConnectorProfileProperties
redshiftConnectorProfileProperties_databaseUrl = (RedshiftConnectorProfileProperties -> Text)
-> (RedshiftConnectorProfileProperties
    -> Text -> RedshiftConnectorProfileProperties)
-> Lens
     RedshiftConnectorProfileProperties
     RedshiftConnectorProfileProperties
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftConnectorProfileProperties' {Text
databaseUrl :: Text
$sel:databaseUrl:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Text
databaseUrl} -> Text
databaseUrl) (\s :: RedshiftConnectorProfileProperties
s@RedshiftConnectorProfileProperties' {} Text
a -> RedshiftConnectorProfileProperties
s {$sel:databaseUrl:RedshiftConnectorProfileProperties' :: Text
databaseUrl = Text
a} :: RedshiftConnectorProfileProperties)

-- | A name for the associated Amazon S3 bucket.
redshiftConnectorProfileProperties_bucketName :: Lens.Lens' RedshiftConnectorProfileProperties Prelude.Text
redshiftConnectorProfileProperties_bucketName :: (Text -> f Text)
-> RedshiftConnectorProfileProperties
-> f RedshiftConnectorProfileProperties
redshiftConnectorProfileProperties_bucketName = (RedshiftConnectorProfileProperties -> Text)
-> (RedshiftConnectorProfileProperties
    -> Text -> RedshiftConnectorProfileProperties)
-> Lens
     RedshiftConnectorProfileProperties
     RedshiftConnectorProfileProperties
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftConnectorProfileProperties' {Text
bucketName :: Text
$sel:bucketName:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Text
bucketName} -> Text
bucketName) (\s :: RedshiftConnectorProfileProperties
s@RedshiftConnectorProfileProperties' {} Text
a -> RedshiftConnectorProfileProperties
s {$sel:bucketName:RedshiftConnectorProfileProperties' :: Text
bucketName = Text
a} :: RedshiftConnectorProfileProperties)

-- | The Amazon Resource Name (ARN) of the IAM role.
redshiftConnectorProfileProperties_roleArn :: Lens.Lens' RedshiftConnectorProfileProperties Prelude.Text
redshiftConnectorProfileProperties_roleArn :: (Text -> f Text)
-> RedshiftConnectorProfileProperties
-> f RedshiftConnectorProfileProperties
redshiftConnectorProfileProperties_roleArn = (RedshiftConnectorProfileProperties -> Text)
-> (RedshiftConnectorProfileProperties
    -> Text -> RedshiftConnectorProfileProperties)
-> Lens
     RedshiftConnectorProfileProperties
     RedshiftConnectorProfileProperties
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftConnectorProfileProperties' {Text
roleArn :: Text
$sel:roleArn:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Text
roleArn} -> Text
roleArn) (\s :: RedshiftConnectorProfileProperties
s@RedshiftConnectorProfileProperties' {} Text
a -> RedshiftConnectorProfileProperties
s {$sel:roleArn:RedshiftConnectorProfileProperties' :: Text
roleArn = Text
a} :: RedshiftConnectorProfileProperties)

instance
  Core.FromJSON
    RedshiftConnectorProfileProperties
  where
  parseJSON :: Value -> Parser RedshiftConnectorProfileProperties
parseJSON =
    String
-> (Object -> Parser RedshiftConnectorProfileProperties)
-> Value
-> Parser RedshiftConnectorProfileProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RedshiftConnectorProfileProperties"
      ( \Object
x ->
          Maybe Text
-> Text -> Text -> Text -> RedshiftConnectorProfileProperties
RedshiftConnectorProfileProperties'
            (Maybe Text
 -> Text -> Text -> Text -> RedshiftConnectorProfileProperties)
-> Parser (Maybe Text)
-> Parser
     (Text -> Text -> Text -> RedshiftConnectorProfileProperties)
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
"bucketPrefix")
            Parser (Text -> Text -> Text -> RedshiftConnectorProfileProperties)
-> Parser Text
-> Parser (Text -> Text -> RedshiftConnectorProfileProperties)
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
"databaseUrl")
            Parser (Text -> Text -> RedshiftConnectorProfileProperties)
-> Parser Text
-> Parser (Text -> RedshiftConnectorProfileProperties)
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
"bucketName")
            Parser (Text -> RedshiftConnectorProfileProperties)
-> Parser Text -> Parser RedshiftConnectorProfileProperties
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
    RedshiftConnectorProfileProperties

instance
  Prelude.NFData
    RedshiftConnectorProfileProperties

instance
  Core.ToJSON
    RedshiftConnectorProfileProperties
  where
  toJSON :: RedshiftConnectorProfileProperties -> Value
toJSON RedshiftConnectorProfileProperties' {Maybe Text
Text
roleArn :: Text
bucketName :: Text
databaseUrl :: Text
bucketPrefix :: Maybe Text
$sel:roleArn:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Text
$sel:bucketName:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Text
$sel:databaseUrl:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Text
$sel:bucketPrefix:RedshiftConnectorProfileProperties' :: RedshiftConnectorProfileProperties -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"bucketPrefix" 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
bucketPrefix,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"databaseUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
databaseUrl),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketName),
            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)
          ]
      )