{-# 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.Kendra.Types.ContentSourceConfiguration
-- 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.Kendra.Types.ContentSourceConfiguration 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

-- | Provides the configuration information for your content sources, such as
-- data sources, FAQs, and content indexed directly via
-- <https://docs.aws.amazon.com/kendra/latest/dg/API_BatchPutDocument.html BatchPutDocument>.
--
-- /See:/ 'newContentSourceConfiguration' smart constructor.
data ContentSourceConfiguration = ContentSourceConfiguration'
  { -- | The identifier of the data sources you want to use for your Amazon
    -- Kendra experience.
    ContentSourceConfiguration -> Maybe (NonEmpty Text)
dataSourceIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | @TRUE@ to use documents you indexed directly using the
    -- @BatchPutDocument@ API.
    ContentSourceConfiguration -> Maybe Bool
directPutContent :: Prelude.Maybe Prelude.Bool,
    -- | The identifier of the FAQs that you want to use for your Amazon Kendra
    -- experience.
    ContentSourceConfiguration -> Maybe (NonEmpty Text)
faqIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (ContentSourceConfiguration -> ContentSourceConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContentSourceConfiguration -> ContentSourceConfiguration -> Bool
$c/= :: ContentSourceConfiguration -> ContentSourceConfiguration -> Bool
== :: ContentSourceConfiguration -> ContentSourceConfiguration -> Bool
$c== :: ContentSourceConfiguration -> ContentSourceConfiguration -> Bool
Prelude.Eq, ReadPrec [ContentSourceConfiguration]
ReadPrec ContentSourceConfiguration
Int -> ReadS ContentSourceConfiguration
ReadS [ContentSourceConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContentSourceConfiguration]
$creadListPrec :: ReadPrec [ContentSourceConfiguration]
readPrec :: ReadPrec ContentSourceConfiguration
$creadPrec :: ReadPrec ContentSourceConfiguration
readList :: ReadS [ContentSourceConfiguration]
$creadList :: ReadS [ContentSourceConfiguration]
readsPrec :: Int -> ReadS ContentSourceConfiguration
$creadsPrec :: Int -> ReadS ContentSourceConfiguration
Prelude.Read, Int -> ContentSourceConfiguration -> ShowS
[ContentSourceConfiguration] -> ShowS
ContentSourceConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContentSourceConfiguration] -> ShowS
$cshowList :: [ContentSourceConfiguration] -> ShowS
show :: ContentSourceConfiguration -> String
$cshow :: ContentSourceConfiguration -> String
showsPrec :: Int -> ContentSourceConfiguration -> ShowS
$cshowsPrec :: Int -> ContentSourceConfiguration -> ShowS
Prelude.Show, forall x.
Rep ContentSourceConfiguration x -> ContentSourceConfiguration
forall x.
ContentSourceConfiguration -> Rep ContentSourceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContentSourceConfiguration x -> ContentSourceConfiguration
$cfrom :: forall x.
ContentSourceConfiguration -> Rep ContentSourceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ContentSourceConfiguration' 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:
--
-- 'dataSourceIds', 'contentSourceConfiguration_dataSourceIds' - The identifier of the data sources you want to use for your Amazon
-- Kendra experience.
--
-- 'directPutContent', 'contentSourceConfiguration_directPutContent' - @TRUE@ to use documents you indexed directly using the
-- @BatchPutDocument@ API.
--
-- 'faqIds', 'contentSourceConfiguration_faqIds' - The identifier of the FAQs that you want to use for your Amazon Kendra
-- experience.
newContentSourceConfiguration ::
  ContentSourceConfiguration
newContentSourceConfiguration :: ContentSourceConfiguration
newContentSourceConfiguration =
  ContentSourceConfiguration'
    { $sel:dataSourceIds:ContentSourceConfiguration' :: Maybe (NonEmpty Text)
dataSourceIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:directPutContent:ContentSourceConfiguration' :: Maybe Bool
directPutContent = forall a. Maybe a
Prelude.Nothing,
      $sel:faqIds:ContentSourceConfiguration' :: Maybe (NonEmpty Text)
faqIds = forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the data sources you want to use for your Amazon
-- Kendra experience.
contentSourceConfiguration_dataSourceIds :: Lens.Lens' ContentSourceConfiguration (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
contentSourceConfiguration_dataSourceIds :: Lens' ContentSourceConfiguration (Maybe (NonEmpty Text))
contentSourceConfiguration_dataSourceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentSourceConfiguration' {Maybe (NonEmpty Text)
dataSourceIds :: Maybe (NonEmpty Text)
$sel:dataSourceIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
dataSourceIds} -> Maybe (NonEmpty Text)
dataSourceIds) (\s :: ContentSourceConfiguration
s@ContentSourceConfiguration' {} Maybe (NonEmpty Text)
a -> ContentSourceConfiguration
s {$sel:dataSourceIds:ContentSourceConfiguration' :: Maybe (NonEmpty Text)
dataSourceIds = Maybe (NonEmpty Text)
a} :: ContentSourceConfiguration) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | @TRUE@ to use documents you indexed directly using the
-- @BatchPutDocument@ API.
contentSourceConfiguration_directPutContent :: Lens.Lens' ContentSourceConfiguration (Prelude.Maybe Prelude.Bool)
contentSourceConfiguration_directPutContent :: Lens' ContentSourceConfiguration (Maybe Bool)
contentSourceConfiguration_directPutContent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentSourceConfiguration' {Maybe Bool
directPutContent :: Maybe Bool
$sel:directPutContent:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe Bool
directPutContent} -> Maybe Bool
directPutContent) (\s :: ContentSourceConfiguration
s@ContentSourceConfiguration' {} Maybe Bool
a -> ContentSourceConfiguration
s {$sel:directPutContent:ContentSourceConfiguration' :: Maybe Bool
directPutContent = Maybe Bool
a} :: ContentSourceConfiguration)

-- | The identifier of the FAQs that you want to use for your Amazon Kendra
-- experience.
contentSourceConfiguration_faqIds :: Lens.Lens' ContentSourceConfiguration (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
contentSourceConfiguration_faqIds :: Lens' ContentSourceConfiguration (Maybe (NonEmpty Text))
contentSourceConfiguration_faqIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentSourceConfiguration' {Maybe (NonEmpty Text)
faqIds :: Maybe (NonEmpty Text)
$sel:faqIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
faqIds} -> Maybe (NonEmpty Text)
faqIds) (\s :: ContentSourceConfiguration
s@ContentSourceConfiguration' {} Maybe (NonEmpty Text)
a -> ContentSourceConfiguration
s {$sel:faqIds:ContentSourceConfiguration' :: Maybe (NonEmpty Text)
faqIds = Maybe (NonEmpty Text)
a} :: ContentSourceConfiguration) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ContentSourceConfiguration where
  parseJSON :: Value -> Parser ContentSourceConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContentSourceConfiguration"
      ( \Object
x ->
          Maybe (NonEmpty Text)
-> Maybe Bool
-> Maybe (NonEmpty Text)
-> ContentSourceConfiguration
ContentSourceConfiguration'
            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
"DataSourceIds")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DirectPutContent")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FaqIds")
      )

instance Prelude.Hashable ContentSourceConfiguration where
  hashWithSalt :: Int -> ContentSourceConfiguration -> Int
hashWithSalt Int
_salt ContentSourceConfiguration' {Maybe Bool
Maybe (NonEmpty Text)
faqIds :: Maybe (NonEmpty Text)
directPutContent :: Maybe Bool
dataSourceIds :: Maybe (NonEmpty Text)
$sel:faqIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
$sel:directPutContent:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe Bool
$sel:dataSourceIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
dataSourceIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
directPutContent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
faqIds

instance Prelude.NFData ContentSourceConfiguration where
  rnf :: ContentSourceConfiguration -> ()
rnf ContentSourceConfiguration' {Maybe Bool
Maybe (NonEmpty Text)
faqIds :: Maybe (NonEmpty Text)
directPutContent :: Maybe Bool
dataSourceIds :: Maybe (NonEmpty Text)
$sel:faqIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
$sel:directPutContent:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe Bool
$sel:dataSourceIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
dataSourceIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
directPutContent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
faqIds

instance Data.ToJSON ContentSourceConfiguration where
  toJSON :: ContentSourceConfiguration -> Value
toJSON ContentSourceConfiguration' {Maybe Bool
Maybe (NonEmpty Text)
faqIds :: Maybe (NonEmpty Text)
directPutContent :: Maybe Bool
dataSourceIds :: Maybe (NonEmpty Text)
$sel:faqIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
$sel:directPutContent:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe Bool
$sel:dataSourceIds:ContentSourceConfiguration' :: ContentSourceConfiguration -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DataSourceIds" 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 (NonEmpty Text)
dataSourceIds,
            (Key
"DirectPutContent" 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 Bool
directPutContent,
            (Key
"FaqIds" 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 (NonEmpty Text)
faqIds
          ]
      )