{-# 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.SiteMapsConfiguration
-- 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.SiteMapsConfiguration 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 the sitemap URLs to crawl.
--
-- /When selecting websites to index, you must adhere to the
-- <https://aws.amazon.com/aup/ Amazon Acceptable Use Policy> and all other
-- Amazon terms. Remember that you must only use Amazon Kendra Web Crawler
-- to index your own webpages, or webpages that you have authorization to
-- index./
--
-- /See:/ 'newSiteMapsConfiguration' smart constructor.
data SiteMapsConfiguration = SiteMapsConfiguration'
  { -- | The list of sitemap URLs of the websites you want to crawl.
    --
    -- The list can include a maximum of three sitemap URLs.
    SiteMapsConfiguration -> [Text]
siteMaps :: [Prelude.Text]
  }
  deriving (SiteMapsConfiguration -> SiteMapsConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SiteMapsConfiguration -> SiteMapsConfiguration -> Bool
$c/= :: SiteMapsConfiguration -> SiteMapsConfiguration -> Bool
== :: SiteMapsConfiguration -> SiteMapsConfiguration -> Bool
$c== :: SiteMapsConfiguration -> SiteMapsConfiguration -> Bool
Prelude.Eq, ReadPrec [SiteMapsConfiguration]
ReadPrec SiteMapsConfiguration
Int -> ReadS SiteMapsConfiguration
ReadS [SiteMapsConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SiteMapsConfiguration]
$creadListPrec :: ReadPrec [SiteMapsConfiguration]
readPrec :: ReadPrec SiteMapsConfiguration
$creadPrec :: ReadPrec SiteMapsConfiguration
readList :: ReadS [SiteMapsConfiguration]
$creadList :: ReadS [SiteMapsConfiguration]
readsPrec :: Int -> ReadS SiteMapsConfiguration
$creadsPrec :: Int -> ReadS SiteMapsConfiguration
Prelude.Read, Int -> SiteMapsConfiguration -> ShowS
[SiteMapsConfiguration] -> ShowS
SiteMapsConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SiteMapsConfiguration] -> ShowS
$cshowList :: [SiteMapsConfiguration] -> ShowS
show :: SiteMapsConfiguration -> String
$cshow :: SiteMapsConfiguration -> String
showsPrec :: Int -> SiteMapsConfiguration -> ShowS
$cshowsPrec :: Int -> SiteMapsConfiguration -> ShowS
Prelude.Show, forall x. Rep SiteMapsConfiguration x -> SiteMapsConfiguration
forall x. SiteMapsConfiguration -> Rep SiteMapsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SiteMapsConfiguration x -> SiteMapsConfiguration
$cfrom :: forall x. SiteMapsConfiguration -> Rep SiteMapsConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SiteMapsConfiguration' 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:
--
-- 'siteMaps', 'siteMapsConfiguration_siteMaps' - The list of sitemap URLs of the websites you want to crawl.
--
-- The list can include a maximum of three sitemap URLs.
newSiteMapsConfiguration ::
  SiteMapsConfiguration
newSiteMapsConfiguration :: SiteMapsConfiguration
newSiteMapsConfiguration =
  SiteMapsConfiguration' {$sel:siteMaps:SiteMapsConfiguration' :: [Text]
siteMaps = forall a. Monoid a => a
Prelude.mempty}

-- | The list of sitemap URLs of the websites you want to crawl.
--
-- The list can include a maximum of three sitemap URLs.
siteMapsConfiguration_siteMaps :: Lens.Lens' SiteMapsConfiguration [Prelude.Text]
siteMapsConfiguration_siteMaps :: Lens' SiteMapsConfiguration [Text]
siteMapsConfiguration_siteMaps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SiteMapsConfiguration' {[Text]
siteMaps :: [Text]
$sel:siteMaps:SiteMapsConfiguration' :: SiteMapsConfiguration -> [Text]
siteMaps} -> [Text]
siteMaps) (\s :: SiteMapsConfiguration
s@SiteMapsConfiguration' {} [Text]
a -> SiteMapsConfiguration
s {$sel:siteMaps:SiteMapsConfiguration' :: [Text]
siteMaps = [Text]
a} :: SiteMapsConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON SiteMapsConfiguration where
  parseJSON :: Value -> Parser SiteMapsConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SiteMapsConfiguration"
      ( \Object
x ->
          [Text] -> SiteMapsConfiguration
SiteMapsConfiguration'
            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
"SiteMaps" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable SiteMapsConfiguration where
  hashWithSalt :: Int -> SiteMapsConfiguration -> Int
hashWithSalt Int
_salt SiteMapsConfiguration' {[Text]
siteMaps :: [Text]
$sel:siteMaps:SiteMapsConfiguration' :: SiteMapsConfiguration -> [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
siteMaps

instance Prelude.NFData SiteMapsConfiguration where
  rnf :: SiteMapsConfiguration -> ()
rnf SiteMapsConfiguration' {[Text]
siteMaps :: [Text]
$sel:siteMaps:SiteMapsConfiguration' :: SiteMapsConfiguration -> [Text]
..} = forall a. NFData a => a -> ()
Prelude.rnf [Text]
siteMaps

instance Data.ToJSON SiteMapsConfiguration where
  toJSON :: SiteMapsConfiguration -> Value
toJSON SiteMapsConfiguration' {[Text]
siteMaps :: [Text]
$sel:siteMaps:SiteMapsConfiguration' :: SiteMapsConfiguration -> [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"SiteMaps" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
siteMaps)]
      )