{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $sel:bucketPrefix:UpsolverDestinationProperties' :: Maybe Text
bucketPrefix =
          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 :: Lens' UpsolverDestinationProperties (Maybe Text)
upsolverDestinationProperties_bucketPrefix = 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 :: Lens' UpsolverDestinationProperties Text
upsolverDestinationProperties_bucketName = 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 :: Lens' UpsolverDestinationProperties UpsolverS3OutputFormatConfig
upsolverDestinationProperties_s3OutputFormatConfig = 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 Data.FromJSON UpsolverDestinationProperties where
  parseJSON :: Value -> Parser UpsolverDestinationProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpsolverDestinationProperties"
      ( \Object
x ->
          Maybe Text
-> Text
-> UpsolverS3OutputFormatConfig
-> UpsolverDestinationProperties
UpsolverDestinationProperties'
            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
"bucketPrefix")
            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
"bucketName")
            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
"s3OutputFormatConfig")
      )

instance
  Prelude.Hashable
    UpsolverDestinationProperties
  where
  hashWithSalt :: Int -> UpsolverDestinationProperties -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
bucketPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` UpsolverS3OutputFormatConfig
s3OutputFormatConfig

instance Prelude.NFData UpsolverDestinationProperties where
  rnf :: UpsolverDestinationProperties -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
bucketPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf UpsolverS3OutputFormatConfig
s3OutputFormatConfig

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"bucketPrefix" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
bucketPrefix,
            forall a. a -> Maybe a
Prelude.Just (Key
"bucketName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucketName),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"s3OutputFormatConfig"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= UpsolverS3OutputFormatConfig
s3OutputFormatConfig
              )
          ]
      )