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

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

-- | The properties that are applied when Amazon Honeycode is used as a
-- destination.
--
-- /See:/ 'newHoneycodeDestinationProperties' smart constructor.
data HoneycodeDestinationProperties = HoneycodeDestinationProperties'
  { HoneycodeDestinationProperties -> Maybe ErrorHandlingConfig
errorHandlingConfig :: Prelude.Maybe ErrorHandlingConfig,
    -- | The object specified in the Amazon Honeycode flow destination.
    HoneycodeDestinationProperties -> Text
object' :: Prelude.Text
  }
  deriving (HoneycodeDestinationProperties
-> HoneycodeDestinationProperties -> Bool
(HoneycodeDestinationProperties
 -> HoneycodeDestinationProperties -> Bool)
-> (HoneycodeDestinationProperties
    -> HoneycodeDestinationProperties -> Bool)
-> Eq HoneycodeDestinationProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HoneycodeDestinationProperties
-> HoneycodeDestinationProperties -> Bool
$c/= :: HoneycodeDestinationProperties
-> HoneycodeDestinationProperties -> Bool
== :: HoneycodeDestinationProperties
-> HoneycodeDestinationProperties -> Bool
$c== :: HoneycodeDestinationProperties
-> HoneycodeDestinationProperties -> Bool
Prelude.Eq, ReadPrec [HoneycodeDestinationProperties]
ReadPrec HoneycodeDestinationProperties
Int -> ReadS HoneycodeDestinationProperties
ReadS [HoneycodeDestinationProperties]
(Int -> ReadS HoneycodeDestinationProperties)
-> ReadS [HoneycodeDestinationProperties]
-> ReadPrec HoneycodeDestinationProperties
-> ReadPrec [HoneycodeDestinationProperties]
-> Read HoneycodeDestinationProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HoneycodeDestinationProperties]
$creadListPrec :: ReadPrec [HoneycodeDestinationProperties]
readPrec :: ReadPrec HoneycodeDestinationProperties
$creadPrec :: ReadPrec HoneycodeDestinationProperties
readList :: ReadS [HoneycodeDestinationProperties]
$creadList :: ReadS [HoneycodeDestinationProperties]
readsPrec :: Int -> ReadS HoneycodeDestinationProperties
$creadsPrec :: Int -> ReadS HoneycodeDestinationProperties
Prelude.Read, Int -> HoneycodeDestinationProperties -> ShowS
[HoneycodeDestinationProperties] -> ShowS
HoneycodeDestinationProperties -> String
(Int -> HoneycodeDestinationProperties -> ShowS)
-> (HoneycodeDestinationProperties -> String)
-> ([HoneycodeDestinationProperties] -> ShowS)
-> Show HoneycodeDestinationProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HoneycodeDestinationProperties] -> ShowS
$cshowList :: [HoneycodeDestinationProperties] -> ShowS
show :: HoneycodeDestinationProperties -> String
$cshow :: HoneycodeDestinationProperties -> String
showsPrec :: Int -> HoneycodeDestinationProperties -> ShowS
$cshowsPrec :: Int -> HoneycodeDestinationProperties -> ShowS
Prelude.Show, (forall x.
 HoneycodeDestinationProperties
 -> Rep HoneycodeDestinationProperties x)
-> (forall x.
    Rep HoneycodeDestinationProperties x
    -> HoneycodeDestinationProperties)
-> Generic HoneycodeDestinationProperties
forall x.
Rep HoneycodeDestinationProperties x
-> HoneycodeDestinationProperties
forall x.
HoneycodeDestinationProperties
-> Rep HoneycodeDestinationProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HoneycodeDestinationProperties x
-> HoneycodeDestinationProperties
$cfrom :: forall x.
HoneycodeDestinationProperties
-> Rep HoneycodeDestinationProperties x
Prelude.Generic)

-- |
-- Create a value of 'HoneycodeDestinationProperties' 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:
--
-- 'errorHandlingConfig', 'honeycodeDestinationProperties_errorHandlingConfig' - Undocumented member.
--
-- 'object'', 'honeycodeDestinationProperties_object' - The object specified in the Amazon Honeycode flow destination.
newHoneycodeDestinationProperties ::
  -- | 'object''
  Prelude.Text ->
  HoneycodeDestinationProperties
newHoneycodeDestinationProperties :: Text -> HoneycodeDestinationProperties
newHoneycodeDestinationProperties Text
pObject_ =
  HoneycodeDestinationProperties' :: Maybe ErrorHandlingConfig -> Text -> HoneycodeDestinationProperties
HoneycodeDestinationProperties'
    { $sel:errorHandlingConfig:HoneycodeDestinationProperties' :: Maybe ErrorHandlingConfig
errorHandlingConfig =
        Maybe ErrorHandlingConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:object':HoneycodeDestinationProperties' :: Text
object' = Text
pObject_
    }

-- | Undocumented member.
honeycodeDestinationProperties_errorHandlingConfig :: Lens.Lens' HoneycodeDestinationProperties (Prelude.Maybe ErrorHandlingConfig)
honeycodeDestinationProperties_errorHandlingConfig :: (Maybe ErrorHandlingConfig -> f (Maybe ErrorHandlingConfig))
-> HoneycodeDestinationProperties
-> f HoneycodeDestinationProperties
honeycodeDestinationProperties_errorHandlingConfig = (HoneycodeDestinationProperties -> Maybe ErrorHandlingConfig)
-> (HoneycodeDestinationProperties
    -> Maybe ErrorHandlingConfig -> HoneycodeDestinationProperties)
-> Lens
     HoneycodeDestinationProperties
     HoneycodeDestinationProperties
     (Maybe ErrorHandlingConfig)
     (Maybe ErrorHandlingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoneycodeDestinationProperties' {Maybe ErrorHandlingConfig
errorHandlingConfig :: Maybe ErrorHandlingConfig
$sel:errorHandlingConfig:HoneycodeDestinationProperties' :: HoneycodeDestinationProperties -> Maybe ErrorHandlingConfig
errorHandlingConfig} -> Maybe ErrorHandlingConfig
errorHandlingConfig) (\s :: HoneycodeDestinationProperties
s@HoneycodeDestinationProperties' {} Maybe ErrorHandlingConfig
a -> HoneycodeDestinationProperties
s {$sel:errorHandlingConfig:HoneycodeDestinationProperties' :: Maybe ErrorHandlingConfig
errorHandlingConfig = Maybe ErrorHandlingConfig
a} :: HoneycodeDestinationProperties)

-- | The object specified in the Amazon Honeycode flow destination.
honeycodeDestinationProperties_object :: Lens.Lens' HoneycodeDestinationProperties Prelude.Text
honeycodeDestinationProperties_object :: (Text -> f Text)
-> HoneycodeDestinationProperties
-> f HoneycodeDestinationProperties
honeycodeDestinationProperties_object = (HoneycodeDestinationProperties -> Text)
-> (HoneycodeDestinationProperties
    -> Text -> HoneycodeDestinationProperties)
-> Lens
     HoneycodeDestinationProperties
     HoneycodeDestinationProperties
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoneycodeDestinationProperties' {Text
object' :: Text
$sel:object':HoneycodeDestinationProperties' :: HoneycodeDestinationProperties -> Text
object'} -> Text
object') (\s :: HoneycodeDestinationProperties
s@HoneycodeDestinationProperties' {} Text
a -> HoneycodeDestinationProperties
s {$sel:object':HoneycodeDestinationProperties' :: Text
object' = Text
a} :: HoneycodeDestinationProperties)

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

instance
  Prelude.Hashable
    HoneycodeDestinationProperties

instance
  Prelude.NFData
    HoneycodeDestinationProperties

instance Core.ToJSON HoneycodeDestinationProperties where
  toJSON :: HoneycodeDestinationProperties -> Value
toJSON HoneycodeDestinationProperties' {Maybe ErrorHandlingConfig
Text
object' :: Text
errorHandlingConfig :: Maybe ErrorHandlingConfig
$sel:object':HoneycodeDestinationProperties' :: HoneycodeDestinationProperties -> Text
$sel:errorHandlingConfig:HoneycodeDestinationProperties' :: HoneycodeDestinationProperties -> Maybe ErrorHandlingConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"errorHandlingConfig" Text -> ErrorHandlingConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ErrorHandlingConfig -> Pair)
-> Maybe ErrorHandlingConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ErrorHandlingConfig
errorHandlingConfig,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"object" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
object')
          ]
      )