{-# 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.HoneyCode.Types.ImportDataSourceConfig
-- 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.HoneyCode.Types.ImportDataSourceConfig where

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

-- | An object that contains the configuration parameters for the data source
-- of an import request.
--
-- /See:/ 'newImportDataSourceConfig' smart constructor.
data ImportDataSourceConfig = ImportDataSourceConfig'
  { -- | The URL from which source data will be downloaded for the import
    -- request.
    ImportDataSourceConfig -> Maybe (Sensitive Text)
dataSourceUrl :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (ImportDataSourceConfig -> ImportDataSourceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportDataSourceConfig -> ImportDataSourceConfig -> Bool
$c/= :: ImportDataSourceConfig -> ImportDataSourceConfig -> Bool
== :: ImportDataSourceConfig -> ImportDataSourceConfig -> Bool
$c== :: ImportDataSourceConfig -> ImportDataSourceConfig -> Bool
Prelude.Eq, Int -> ImportDataSourceConfig -> ShowS
[ImportDataSourceConfig] -> ShowS
ImportDataSourceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportDataSourceConfig] -> ShowS
$cshowList :: [ImportDataSourceConfig] -> ShowS
show :: ImportDataSourceConfig -> String
$cshow :: ImportDataSourceConfig -> String
showsPrec :: Int -> ImportDataSourceConfig -> ShowS
$cshowsPrec :: Int -> ImportDataSourceConfig -> ShowS
Prelude.Show, forall x. Rep ImportDataSourceConfig x -> ImportDataSourceConfig
forall x. ImportDataSourceConfig -> Rep ImportDataSourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportDataSourceConfig x -> ImportDataSourceConfig
$cfrom :: forall x. ImportDataSourceConfig -> Rep ImportDataSourceConfig x
Prelude.Generic)

-- |
-- Create a value of 'ImportDataSourceConfig' 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:
--
-- 'dataSourceUrl', 'importDataSourceConfig_dataSourceUrl' - The URL from which source data will be downloaded for the import
-- request.
newImportDataSourceConfig ::
  ImportDataSourceConfig
newImportDataSourceConfig :: ImportDataSourceConfig
newImportDataSourceConfig =
  ImportDataSourceConfig'
    { $sel:dataSourceUrl:ImportDataSourceConfig' :: Maybe (Sensitive Text)
dataSourceUrl =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The URL from which source data will be downloaded for the import
-- request.
importDataSourceConfig_dataSourceUrl :: Lens.Lens' ImportDataSourceConfig (Prelude.Maybe Prelude.Text)
importDataSourceConfig_dataSourceUrl :: Lens' ImportDataSourceConfig (Maybe Text)
importDataSourceConfig_dataSourceUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportDataSourceConfig' {Maybe (Sensitive Text)
dataSourceUrl :: Maybe (Sensitive Text)
$sel:dataSourceUrl:ImportDataSourceConfig' :: ImportDataSourceConfig -> Maybe (Sensitive Text)
dataSourceUrl} -> Maybe (Sensitive Text)
dataSourceUrl) (\s :: ImportDataSourceConfig
s@ImportDataSourceConfig' {} Maybe (Sensitive Text)
a -> ImportDataSourceConfig
s {$sel:dataSourceUrl:ImportDataSourceConfig' :: Maybe (Sensitive Text)
dataSourceUrl = Maybe (Sensitive Text)
a} :: ImportDataSourceConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON ImportDataSourceConfig where
  parseJSON :: Value -> Parser ImportDataSourceConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ImportDataSourceConfig"
      ( \Object
x ->
          Maybe (Sensitive Text) -> ImportDataSourceConfig
ImportDataSourceConfig'
            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
"dataSourceUrl")
      )

instance Prelude.Hashable ImportDataSourceConfig where
  hashWithSalt :: Int -> ImportDataSourceConfig -> Int
hashWithSalt Int
_salt ImportDataSourceConfig' {Maybe (Sensitive Text)
dataSourceUrl :: Maybe (Sensitive Text)
$sel:dataSourceUrl:ImportDataSourceConfig' :: ImportDataSourceConfig -> Maybe (Sensitive Text)
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
dataSourceUrl

instance Prelude.NFData ImportDataSourceConfig where
  rnf :: ImportDataSourceConfig -> ()
rnf ImportDataSourceConfig' {Maybe (Sensitive Text)
dataSourceUrl :: Maybe (Sensitive Text)
$sel:dataSourceUrl:ImportDataSourceConfig' :: ImportDataSourceConfig -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
dataSourceUrl

instance Data.ToJSON ImportDataSourceConfig where
  toJSON :: ImportDataSourceConfig -> Value
toJSON ImportDataSourceConfig' {Maybe (Sensitive Text)
dataSourceUrl :: Maybe (Sensitive Text)
$sel:dataSourceUrl:ImportDataSourceConfig' :: ImportDataSourceConfig -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"dataSourceUrl" 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 (Sensitive Text)
dataSourceUrl
          ]
      )