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

import Amazonka.AppFlow.Types.UpsolverS3OutputFormatConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The properties that are applied when Upsolver is used as a destination.
--
-- /See:/ 'newUpsolverDestinationProperties' smart constructor.
data UpsolverDestinationProperties = UpsolverDestinationProperties'
  { -- | The object key for the destination Upsolver Amazon S3 bucket in which
    -- Amazon AppFlow places the files.
    UpsolverDestinationProperties -> Maybe Text
bucketPrefix :: Prelude.Maybe Prelude.Text,
    -- | The Upsolver Amazon S3 bucket name in which Amazon AppFlow places the
    -- transferred data.
    UpsolverDestinationProperties -> Text
bucketName :: Prelude.Text,
    -- | The configuration that determines how data is formatted when Upsolver is
    -- used as the flow destination.
    UpsolverDestinationProperties -> UpsolverS3OutputFormatConfig
s3OutputFormatConfig :: UpsolverS3OutputFormatConfig
  }
  deriving (UpsolverDestinationProperties
-> UpsolverDestinationProperties -> Bool
(UpsolverDestinationProperties
 -> UpsolverDestinationProperties -> Bool)
-> (UpsolverDestinationProperties
    -> UpsolverDestinationProperties -> Bool)
-> Eq UpsolverDestinationProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpsolverDestinationProperties
-> UpsolverDestinationProperties -> Bool
$c/= :: UpsolverDestinationProperties
-> UpsolverDestinationProperties -> Bool
== :: UpsolverDestinationProperties
-> UpsolverDestinationProperties -> Bool
$c== :: UpsolverDestinationProperties
-> UpsolverDestinationProperties -> Bool
Prelude.Eq, ReadPrec [UpsolverDestinationProperties]
ReadPrec UpsolverDestinationProperties
Int -> ReadS UpsolverDestinationProperties
ReadS [UpsolverDestinationProperties]
(Int -> ReadS UpsolverDestinationProperties)
-> ReadS [UpsolverDestinationProperties]
-> ReadPrec UpsolverDestinationProperties
-> ReadPrec [UpsolverDestinationProperties]
-> Read UpsolverDestinationProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpsolverDestinationProperties]
$creadListPrec :: ReadPrec [UpsolverDestinationProperties]
readPrec :: ReadPrec UpsolverDestinationProperties
$creadPrec :: ReadPrec UpsolverDestinationProperties
readList :: ReadS [UpsolverDestinationProperties]
$creadList :: ReadS [UpsolverDestinationProperties]
readsPrec :: Int -> ReadS UpsolverDestinationProperties
$creadsPrec :: Int -> ReadS UpsolverDestinationProperties
Prelude.Read, Int -> UpsolverDestinationProperties -> ShowS
[UpsolverDestinationProperties] -> ShowS
UpsolverDestinationProperties -> String
(Int -> UpsolverDestinationProperties -> ShowS)
-> (UpsolverDestinationProperties -> String)
-> ([UpsolverDestinationProperties] -> ShowS)
-> Show UpsolverDestinationProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpsolverDestinationProperties] -> ShowS
$cshowList :: [UpsolverDestinationProperties] -> ShowS
show :: UpsolverDestinationProperties -> String
$cshow :: UpsolverDestinationProperties -> String
showsPrec :: Int -> UpsolverDestinationProperties -> ShowS
$cshowsPrec :: Int -> UpsolverDestinationProperties -> ShowS
Prelude.Show, (forall x.
 UpsolverDestinationProperties
 -> Rep UpsolverDestinationProperties x)
-> (forall x.
    Rep UpsolverDestinationProperties x
    -> UpsolverDestinationProperties)
-> Generic UpsolverDestinationProperties
forall x.
Rep UpsolverDestinationProperties x
-> UpsolverDestinationProperties
forall x.
UpsolverDestinationProperties
-> Rep UpsolverDestinationProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpsolverDestinationProperties x
-> UpsolverDestinationProperties
$cfrom :: forall x.
UpsolverDestinationProperties
-> Rep UpsolverDestinationProperties x
Prelude.Generic)

-- |
-- Create a value of 'UpsolverDestinationProperties' 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', 'upsolverDestinationProperties_bucketPrefix' - The object key for the destination Upsolver Amazon S3 bucket in which
-- Amazon AppFlow places the files.
--
-- 'bucketName', 'upsolverDestinationProperties_bucketName' - The Upsolver Amazon S3 bucket name in which Amazon AppFlow places the
-- transferred data.
--
-- 's3OutputFormatConfig', 'upsolverDestinationProperties_s3OutputFormatConfig' - The configuration that determines how data is formatted when Upsolver is
-- used as the flow destination.
newUpsolverDestinationProperties ::
  -- | 'bucketName'
  Prelude.Text ->
  -- | 's3OutputFormatConfig'
  UpsolverS3OutputFormatConfig ->
  UpsolverDestinationProperties
newUpsolverDestinationProperties :: Text
-> UpsolverS3OutputFormatConfig -> UpsolverDestinationProperties
newUpsolverDestinationProperties
  Text
pBucketName_
  UpsolverS3OutputFormatConfig
pS3OutputFormatConfig_ =
    UpsolverDestinationProperties' :: Maybe Text
-> Text
-> UpsolverS3OutputFormatConfig
-> UpsolverDestinationProperties
UpsolverDestinationProperties'
      { $sel:bucketPrefix:UpsolverDestinationProperties' :: Maybe Text
bucketPrefix =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:bucketName:UpsolverDestinationProperties' :: Text
bucketName = Text
pBucketName_,
        $sel:s3OutputFormatConfig:UpsolverDestinationProperties' :: UpsolverS3OutputFormatConfig
s3OutputFormatConfig =
          UpsolverS3OutputFormatConfig
pS3OutputFormatConfig_
      }

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

-- | The Upsolver Amazon S3 bucket name in which Amazon AppFlow places the
-- transferred data.
upsolverDestinationProperties_bucketName :: Lens.Lens' UpsolverDestinationProperties Prelude.Text
upsolverDestinationProperties_bucketName :: (Text -> f Text)
-> UpsolverDestinationProperties -> f UpsolverDestinationProperties
upsolverDestinationProperties_bucketName = (UpsolverDestinationProperties -> Text)
-> (UpsolverDestinationProperties
    -> Text -> UpsolverDestinationProperties)
-> Lens
     UpsolverDestinationProperties
     UpsolverDestinationProperties
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpsolverDestinationProperties' {Text
bucketName :: Text
$sel:bucketName:UpsolverDestinationProperties' :: UpsolverDestinationProperties -> Text
bucketName} -> Text
bucketName) (\s :: UpsolverDestinationProperties
s@UpsolverDestinationProperties' {} Text
a -> UpsolverDestinationProperties
s {$sel:bucketName:UpsolverDestinationProperties' :: Text
bucketName = Text
a} :: UpsolverDestinationProperties)

-- | The configuration that determines how data is formatted when Upsolver is
-- used as the flow destination.
upsolverDestinationProperties_s3OutputFormatConfig :: Lens.Lens' UpsolverDestinationProperties UpsolverS3OutputFormatConfig
upsolverDestinationProperties_s3OutputFormatConfig :: (UpsolverS3OutputFormatConfig -> f UpsolverS3OutputFormatConfig)
-> UpsolverDestinationProperties -> f UpsolverDestinationProperties
upsolverDestinationProperties_s3OutputFormatConfig = (UpsolverDestinationProperties -> UpsolverS3OutputFormatConfig)
-> (UpsolverDestinationProperties
    -> UpsolverS3OutputFormatConfig -> UpsolverDestinationProperties)
-> Lens
     UpsolverDestinationProperties
     UpsolverDestinationProperties
     UpsolverS3OutputFormatConfig
     UpsolverS3OutputFormatConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpsolverDestinationProperties' {UpsolverS3OutputFormatConfig
s3OutputFormatConfig :: UpsolverS3OutputFormatConfig
$sel:s3OutputFormatConfig:UpsolverDestinationProperties' :: UpsolverDestinationProperties -> UpsolverS3OutputFormatConfig
s3OutputFormatConfig} -> UpsolverS3OutputFormatConfig
s3OutputFormatConfig) (\s :: UpsolverDestinationProperties
s@UpsolverDestinationProperties' {} UpsolverS3OutputFormatConfig
a -> UpsolverDestinationProperties
s {$sel:s3OutputFormatConfig:UpsolverDestinationProperties' :: UpsolverS3OutputFormatConfig
s3OutputFormatConfig = UpsolverS3OutputFormatConfig
a} :: UpsolverDestinationProperties)

instance Core.FromJSON UpsolverDestinationProperties where
  parseJSON :: Value -> Parser UpsolverDestinationProperties
parseJSON =
    String
-> (Object -> Parser UpsolverDestinationProperties)
-> Value
-> Parser UpsolverDestinationProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UpsolverDestinationProperties"
      ( \Object
x ->
          Maybe Text
-> Text
-> UpsolverS3OutputFormatConfig
-> UpsolverDestinationProperties
UpsolverDestinationProperties'
            (Maybe Text
 -> Text
 -> UpsolverS3OutputFormatConfig
 -> UpsolverDestinationProperties)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> UpsolverS3OutputFormatConfig -> UpsolverDestinationProperties)
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
   -> UpsolverS3OutputFormatConfig -> UpsolverDestinationProperties)
-> Parser Text
-> Parser
     (UpsolverS3OutputFormatConfig -> UpsolverDestinationProperties)
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
  (UpsolverS3OutputFormatConfig -> UpsolverDestinationProperties)
-> Parser UpsolverS3OutputFormatConfig
-> Parser UpsolverDestinationProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser UpsolverS3OutputFormatConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"s3OutputFormatConfig")
      )

instance
  Prelude.Hashable
    UpsolverDestinationProperties

instance Prelude.NFData UpsolverDestinationProperties

instance Core.ToJSON UpsolverDestinationProperties where
  toJSON :: UpsolverDestinationProperties -> Value
toJSON UpsolverDestinationProperties' {Maybe Text
Text
UpsolverS3OutputFormatConfig
s3OutputFormatConfig :: UpsolverS3OutputFormatConfig
bucketName :: Text
bucketPrefix :: Maybe Text
$sel:s3OutputFormatConfig:UpsolverDestinationProperties' :: UpsolverDestinationProperties -> UpsolverS3OutputFormatConfig
$sel:bucketName:UpsolverDestinationProperties' :: UpsolverDestinationProperties -> Text
$sel:bucketPrefix:UpsolverDestinationProperties' :: UpsolverDestinationProperties -> 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
"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
"s3OutputFormatConfig"
                  Text -> UpsolverS3OutputFormatConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= UpsolverS3OutputFormatConfig
s3OutputFormatConfig
              )
          ]
      )