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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.DataSourceStatus
import Amazonka.Kendra.Types.DataSourceType
import qualified Amazonka.Prelude as Prelude

-- | Summary information for a Amazon Kendra data source.
--
-- /See:/ 'newDataSourceSummary' smart constructor.
data DataSourceSummary = DataSourceSummary'
  { -- | The UNIX datetime that the data source was created.
    DataSourceSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The identifier for the data source.
    DataSourceSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The code for a language. This shows a supported language for all
    -- documents in the data source. English is supported by default. For more
    -- information on supported languages, including their codes, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
    DataSourceSummary -> Maybe Text
languageCode :: Prelude.Maybe Prelude.Text,
    -- | The name of the data source.
    DataSourceSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The status of the data source. When the status is @ACTIVE@ the data
    -- source is ready to use.
    DataSourceSummary -> Maybe DataSourceStatus
status :: Prelude.Maybe DataSourceStatus,
    -- | The type of the data source.
    DataSourceSummary -> Maybe DataSourceType
type' :: Prelude.Maybe DataSourceType,
    -- | The UNIX datetime that the data source was lasted updated.
    DataSourceSummary -> Maybe POSIX
updatedAt :: Prelude.Maybe Data.POSIX
  }
  deriving (DataSourceSummary -> DataSourceSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSourceSummary -> DataSourceSummary -> Bool
$c/= :: DataSourceSummary -> DataSourceSummary -> Bool
== :: DataSourceSummary -> DataSourceSummary -> Bool
$c== :: DataSourceSummary -> DataSourceSummary -> Bool
Prelude.Eq, ReadPrec [DataSourceSummary]
ReadPrec DataSourceSummary
Int -> ReadS DataSourceSummary
ReadS [DataSourceSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSourceSummary]
$creadListPrec :: ReadPrec [DataSourceSummary]
readPrec :: ReadPrec DataSourceSummary
$creadPrec :: ReadPrec DataSourceSummary
readList :: ReadS [DataSourceSummary]
$creadList :: ReadS [DataSourceSummary]
readsPrec :: Int -> ReadS DataSourceSummary
$creadsPrec :: Int -> ReadS DataSourceSummary
Prelude.Read, Int -> DataSourceSummary -> ShowS
[DataSourceSummary] -> ShowS
DataSourceSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSourceSummary] -> ShowS
$cshowList :: [DataSourceSummary] -> ShowS
show :: DataSourceSummary -> String
$cshow :: DataSourceSummary -> String
showsPrec :: Int -> DataSourceSummary -> ShowS
$cshowsPrec :: Int -> DataSourceSummary -> ShowS
Prelude.Show, forall x. Rep DataSourceSummary x -> DataSourceSummary
forall x. DataSourceSummary -> Rep DataSourceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSourceSummary x -> DataSourceSummary
$cfrom :: forall x. DataSourceSummary -> Rep DataSourceSummary x
Prelude.Generic)

-- |
-- Create a value of 'DataSourceSummary' 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:
--
-- 'createdAt', 'dataSourceSummary_createdAt' - The UNIX datetime that the data source was created.
--
-- 'id', 'dataSourceSummary_id' - The identifier for the data source.
--
-- 'languageCode', 'dataSourceSummary_languageCode' - The code for a language. This shows a supported language for all
-- documents in the data source. English is supported by default. For more
-- information on supported languages, including their codes, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
--
-- 'name', 'dataSourceSummary_name' - The name of the data source.
--
-- 'status', 'dataSourceSummary_status' - The status of the data source. When the status is @ACTIVE@ the data
-- source is ready to use.
--
-- 'type'', 'dataSourceSummary_type' - The type of the data source.
--
-- 'updatedAt', 'dataSourceSummary_updatedAt' - The UNIX datetime that the data source was lasted updated.
newDataSourceSummary ::
  DataSourceSummary
newDataSourceSummary :: DataSourceSummary
newDataSourceSummary =
  DataSourceSummary'
    { $sel:createdAt:DataSourceSummary' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:id:DataSourceSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:DataSourceSummary' :: Maybe Text
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:name:DataSourceSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DataSourceSummary' :: Maybe DataSourceStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:type':DataSourceSummary' :: Maybe DataSourceType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:DataSourceSummary' :: Maybe POSIX
updatedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | The UNIX datetime that the data source was created.
dataSourceSummary_createdAt :: Lens.Lens' DataSourceSummary (Prelude.Maybe Prelude.UTCTime)
dataSourceSummary_createdAt :: Lens' DataSourceSummary (Maybe UTCTime)
dataSourceSummary_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:DataSourceSummary' :: DataSourceSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: DataSourceSummary
s@DataSourceSummary' {} Maybe POSIX
a -> DataSourceSummary
s {$sel:createdAt:DataSourceSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: DataSourceSummary) 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 :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The identifier for the data source.
dataSourceSummary_id :: Lens.Lens' DataSourceSummary (Prelude.Maybe Prelude.Text)
dataSourceSummary_id :: Lens' DataSourceSummary (Maybe Text)
dataSourceSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceSummary' {Maybe Text
id :: Maybe Text
$sel:id:DataSourceSummary' :: DataSourceSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: DataSourceSummary
s@DataSourceSummary' {} Maybe Text
a -> DataSourceSummary
s {$sel:id:DataSourceSummary' :: Maybe Text
id = Maybe Text
a} :: DataSourceSummary)

-- | The code for a language. This shows a supported language for all
-- documents in the data source. English is supported by default. For more
-- information on supported languages, including their codes, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
dataSourceSummary_languageCode :: Lens.Lens' DataSourceSummary (Prelude.Maybe Prelude.Text)
dataSourceSummary_languageCode :: Lens' DataSourceSummary (Maybe Text)
dataSourceSummary_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceSummary' {Maybe Text
languageCode :: Maybe Text
$sel:languageCode:DataSourceSummary' :: DataSourceSummary -> Maybe Text
languageCode} -> Maybe Text
languageCode) (\s :: DataSourceSummary
s@DataSourceSummary' {} Maybe Text
a -> DataSourceSummary
s {$sel:languageCode:DataSourceSummary' :: Maybe Text
languageCode = Maybe Text
a} :: DataSourceSummary)

-- | The name of the data source.
dataSourceSummary_name :: Lens.Lens' DataSourceSummary (Prelude.Maybe Prelude.Text)
dataSourceSummary_name :: Lens' DataSourceSummary (Maybe Text)
dataSourceSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceSummary' {Maybe Text
name :: Maybe Text
$sel:name:DataSourceSummary' :: DataSourceSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: DataSourceSummary
s@DataSourceSummary' {} Maybe Text
a -> DataSourceSummary
s {$sel:name:DataSourceSummary' :: Maybe Text
name = Maybe Text
a} :: DataSourceSummary)

-- | The status of the data source. When the status is @ACTIVE@ the data
-- source is ready to use.
dataSourceSummary_status :: Lens.Lens' DataSourceSummary (Prelude.Maybe DataSourceStatus)
dataSourceSummary_status :: Lens' DataSourceSummary (Maybe DataSourceStatus)
dataSourceSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceSummary' {Maybe DataSourceStatus
status :: Maybe DataSourceStatus
$sel:status:DataSourceSummary' :: DataSourceSummary -> Maybe DataSourceStatus
status} -> Maybe DataSourceStatus
status) (\s :: DataSourceSummary
s@DataSourceSummary' {} Maybe DataSourceStatus
a -> DataSourceSummary
s {$sel:status:DataSourceSummary' :: Maybe DataSourceStatus
status = Maybe DataSourceStatus
a} :: DataSourceSummary)

-- | The type of the data source.
dataSourceSummary_type :: Lens.Lens' DataSourceSummary (Prelude.Maybe DataSourceType)
dataSourceSummary_type :: Lens' DataSourceSummary (Maybe DataSourceType)
dataSourceSummary_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceSummary' {Maybe DataSourceType
type' :: Maybe DataSourceType
$sel:type':DataSourceSummary' :: DataSourceSummary -> Maybe DataSourceType
type'} -> Maybe DataSourceType
type') (\s :: DataSourceSummary
s@DataSourceSummary' {} Maybe DataSourceType
a -> DataSourceSummary
s {$sel:type':DataSourceSummary' :: Maybe DataSourceType
type' = Maybe DataSourceType
a} :: DataSourceSummary)

-- | The UNIX datetime that the data source was lasted updated.
dataSourceSummary_updatedAt :: Lens.Lens' DataSourceSummary (Prelude.Maybe Prelude.UTCTime)
dataSourceSummary_updatedAt :: Lens' DataSourceSummary (Maybe UTCTime)
dataSourceSummary_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceSummary' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:DataSourceSummary' :: DataSourceSummary -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: DataSourceSummary
s@DataSourceSummary' {} Maybe POSIX
a -> DataSourceSummary
s {$sel:updatedAt:DataSourceSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: DataSourceSummary) 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 :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON DataSourceSummary where
  parseJSON :: Value -> Parser DataSourceSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataSourceSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe DataSourceStatus
-> Maybe DataSourceType
-> Maybe POSIX
-> DataSourceSummary
DataSourceSummary'
            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
"CreatedAt")
            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
"Id")
            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
"LanguageCode")
            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
"Name")
            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
"Status")
            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
"Type")
            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
"UpdatedAt")
      )

instance Prelude.Hashable DataSourceSummary where
  hashWithSalt :: Int -> DataSourceSummary -> Int
hashWithSalt Int
_salt DataSourceSummary' {Maybe Text
Maybe POSIX
Maybe DataSourceStatus
Maybe DataSourceType
updatedAt :: Maybe POSIX
type' :: Maybe DataSourceType
status :: Maybe DataSourceStatus
name :: Maybe Text
languageCode :: Maybe Text
id :: Maybe Text
createdAt :: Maybe POSIX
$sel:updatedAt:DataSourceSummary' :: DataSourceSummary -> Maybe POSIX
$sel:type':DataSourceSummary' :: DataSourceSummary -> Maybe DataSourceType
$sel:status:DataSourceSummary' :: DataSourceSummary -> Maybe DataSourceStatus
$sel:name:DataSourceSummary' :: DataSourceSummary -> Maybe Text
$sel:languageCode:DataSourceSummary' :: DataSourceSummary -> Maybe Text
$sel:id:DataSourceSummary' :: DataSourceSummary -> Maybe Text
$sel:createdAt:DataSourceSummary' :: DataSourceSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataSourceStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataSourceType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
updatedAt

instance Prelude.NFData DataSourceSummary where
  rnf :: DataSourceSummary -> ()
rnf DataSourceSummary' {Maybe Text
Maybe POSIX
Maybe DataSourceStatus
Maybe DataSourceType
updatedAt :: Maybe POSIX
type' :: Maybe DataSourceType
status :: Maybe DataSourceStatus
name :: Maybe Text
languageCode :: Maybe Text
id :: Maybe Text
createdAt :: Maybe POSIX
$sel:updatedAt:DataSourceSummary' :: DataSourceSummary -> Maybe POSIX
$sel:type':DataSourceSummary' :: DataSourceSummary -> Maybe DataSourceType
$sel:status:DataSourceSummary' :: DataSourceSummary -> Maybe DataSourceStatus
$sel:name:DataSourceSummary' :: DataSourceSummary -> Maybe Text
$sel:languageCode:DataSourceSummary' :: DataSourceSummary -> Maybe Text
$sel:id:DataSourceSummary' :: DataSourceSummary -> Maybe Text
$sel:createdAt:DataSourceSummary' :: DataSourceSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataSourceStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataSourceType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
updatedAt