{-# 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.IndexConfigurationSummary
-- 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.IndexConfigurationSummary 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.IndexEdition
import Amazonka.Kendra.Types.IndexStatus
import qualified Amazonka.Prelude as Prelude

-- | Summary information on the configuration of an index.
--
-- /See:/ 'newIndexConfigurationSummary' smart constructor.
data IndexConfigurationSummary = IndexConfigurationSummary'
  { -- | Indicates whether the index is a Enterprise Edition index or a Developer
    -- Edition index.
    IndexConfigurationSummary -> Maybe IndexEdition
edition :: Prelude.Maybe IndexEdition,
    -- | A identifier for the index. Use this to identify the index when you are
    -- using APIs such as @Query@, @DescribeIndex@, @UpdateIndex@, and
    -- @DeleteIndex@.
    IndexConfigurationSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the index.
    IndexConfigurationSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Unix timestamp when the index was created.
    IndexConfigurationSummary -> POSIX
createdAt :: Data.POSIX,
    -- | The Unix timestamp when the index was last updated by the @UpdateIndex@
    -- API.
    IndexConfigurationSummary -> POSIX
updatedAt :: Data.POSIX,
    -- | The current status of the index. When the status is @ACTIVE@, the index
    -- is ready to search.
    IndexConfigurationSummary -> IndexStatus
status :: IndexStatus
  }
  deriving (IndexConfigurationSummary -> IndexConfigurationSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IndexConfigurationSummary -> IndexConfigurationSummary -> Bool
$c/= :: IndexConfigurationSummary -> IndexConfigurationSummary -> Bool
== :: IndexConfigurationSummary -> IndexConfigurationSummary -> Bool
$c== :: IndexConfigurationSummary -> IndexConfigurationSummary -> Bool
Prelude.Eq, ReadPrec [IndexConfigurationSummary]
ReadPrec IndexConfigurationSummary
Int -> ReadS IndexConfigurationSummary
ReadS [IndexConfigurationSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IndexConfigurationSummary]
$creadListPrec :: ReadPrec [IndexConfigurationSummary]
readPrec :: ReadPrec IndexConfigurationSummary
$creadPrec :: ReadPrec IndexConfigurationSummary
readList :: ReadS [IndexConfigurationSummary]
$creadList :: ReadS [IndexConfigurationSummary]
readsPrec :: Int -> ReadS IndexConfigurationSummary
$creadsPrec :: Int -> ReadS IndexConfigurationSummary
Prelude.Read, Int -> IndexConfigurationSummary -> ShowS
[IndexConfigurationSummary] -> ShowS
IndexConfigurationSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IndexConfigurationSummary] -> ShowS
$cshowList :: [IndexConfigurationSummary] -> ShowS
show :: IndexConfigurationSummary -> String
$cshow :: IndexConfigurationSummary -> String
showsPrec :: Int -> IndexConfigurationSummary -> ShowS
$cshowsPrec :: Int -> IndexConfigurationSummary -> ShowS
Prelude.Show, forall x.
Rep IndexConfigurationSummary x -> IndexConfigurationSummary
forall x.
IndexConfigurationSummary -> Rep IndexConfigurationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IndexConfigurationSummary x -> IndexConfigurationSummary
$cfrom :: forall x.
IndexConfigurationSummary -> Rep IndexConfigurationSummary x
Prelude.Generic)

-- |
-- Create a value of 'IndexConfigurationSummary' 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:
--
-- 'edition', 'indexConfigurationSummary_edition' - Indicates whether the index is a Enterprise Edition index or a Developer
-- Edition index.
--
-- 'id', 'indexConfigurationSummary_id' - A identifier for the index. Use this to identify the index when you are
-- using APIs such as @Query@, @DescribeIndex@, @UpdateIndex@, and
-- @DeleteIndex@.
--
-- 'name', 'indexConfigurationSummary_name' - The name of the index.
--
-- 'createdAt', 'indexConfigurationSummary_createdAt' - The Unix timestamp when the index was created.
--
-- 'updatedAt', 'indexConfigurationSummary_updatedAt' - The Unix timestamp when the index was last updated by the @UpdateIndex@
-- API.
--
-- 'status', 'indexConfigurationSummary_status' - The current status of the index. When the status is @ACTIVE@, the index
-- is ready to search.
newIndexConfigurationSummary ::
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'updatedAt'
  Prelude.UTCTime ->
  -- | 'status'
  IndexStatus ->
  IndexConfigurationSummary
newIndexConfigurationSummary :: UTCTime -> UTCTime -> IndexStatus -> IndexConfigurationSummary
newIndexConfigurationSummary
  UTCTime
pCreatedAt_
  UTCTime
pUpdatedAt_
  IndexStatus
pStatus_ =
    IndexConfigurationSummary'
      { $sel:edition:IndexConfigurationSummary' :: Maybe IndexEdition
edition =
          forall a. Maybe a
Prelude.Nothing,
        $sel:id:IndexConfigurationSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
        $sel:name:IndexConfigurationSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
        $sel:createdAt:IndexConfigurationSummary' :: POSIX
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:updatedAt:IndexConfigurationSummary' :: POSIX
updatedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdatedAt_,
        $sel:status:IndexConfigurationSummary' :: IndexStatus
status = IndexStatus
pStatus_
      }

-- | Indicates whether the index is a Enterprise Edition index or a Developer
-- Edition index.
indexConfigurationSummary_edition :: Lens.Lens' IndexConfigurationSummary (Prelude.Maybe IndexEdition)
indexConfigurationSummary_edition :: Lens' IndexConfigurationSummary (Maybe IndexEdition)
indexConfigurationSummary_edition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexConfigurationSummary' {Maybe IndexEdition
edition :: Maybe IndexEdition
$sel:edition:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe IndexEdition
edition} -> Maybe IndexEdition
edition) (\s :: IndexConfigurationSummary
s@IndexConfigurationSummary' {} Maybe IndexEdition
a -> IndexConfigurationSummary
s {$sel:edition:IndexConfigurationSummary' :: Maybe IndexEdition
edition = Maybe IndexEdition
a} :: IndexConfigurationSummary)

-- | A identifier for the index. Use this to identify the index when you are
-- using APIs such as @Query@, @DescribeIndex@, @UpdateIndex@, and
-- @DeleteIndex@.
indexConfigurationSummary_id :: Lens.Lens' IndexConfigurationSummary (Prelude.Maybe Prelude.Text)
indexConfigurationSummary_id :: Lens' IndexConfigurationSummary (Maybe Text)
indexConfigurationSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexConfigurationSummary' {Maybe Text
id :: Maybe Text
$sel:id:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: IndexConfigurationSummary
s@IndexConfigurationSummary' {} Maybe Text
a -> IndexConfigurationSummary
s {$sel:id:IndexConfigurationSummary' :: Maybe Text
id = Maybe Text
a} :: IndexConfigurationSummary)

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

-- | The Unix timestamp when the index was created.
indexConfigurationSummary_createdAt :: Lens.Lens' IndexConfigurationSummary Prelude.UTCTime
indexConfigurationSummary_createdAt :: Lens' IndexConfigurationSummary UTCTime
indexConfigurationSummary_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexConfigurationSummary' {POSIX
createdAt :: POSIX
$sel:createdAt:IndexConfigurationSummary' :: IndexConfigurationSummary -> POSIX
createdAt} -> POSIX
createdAt) (\s :: IndexConfigurationSummary
s@IndexConfigurationSummary' {} POSIX
a -> IndexConfigurationSummary
s {$sel:createdAt:IndexConfigurationSummary' :: POSIX
createdAt = POSIX
a} :: IndexConfigurationSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Unix timestamp when the index was last updated by the @UpdateIndex@
-- API.
indexConfigurationSummary_updatedAt :: Lens.Lens' IndexConfigurationSummary Prelude.UTCTime
indexConfigurationSummary_updatedAt :: Lens' IndexConfigurationSummary UTCTime
indexConfigurationSummary_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexConfigurationSummary' {POSIX
updatedAt :: POSIX
$sel:updatedAt:IndexConfigurationSummary' :: IndexConfigurationSummary -> POSIX
updatedAt} -> POSIX
updatedAt) (\s :: IndexConfigurationSummary
s@IndexConfigurationSummary' {} POSIX
a -> IndexConfigurationSummary
s {$sel:updatedAt:IndexConfigurationSummary' :: POSIX
updatedAt = POSIX
a} :: IndexConfigurationSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The current status of the index. When the status is @ACTIVE@, the index
-- is ready to search.
indexConfigurationSummary_status :: Lens.Lens' IndexConfigurationSummary IndexStatus
indexConfigurationSummary_status :: Lens' IndexConfigurationSummary IndexStatus
indexConfigurationSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexConfigurationSummary' {IndexStatus
status :: IndexStatus
$sel:status:IndexConfigurationSummary' :: IndexConfigurationSummary -> IndexStatus
status} -> IndexStatus
status) (\s :: IndexConfigurationSummary
s@IndexConfigurationSummary' {} IndexStatus
a -> IndexConfigurationSummary
s {$sel:status:IndexConfigurationSummary' :: IndexStatus
status = IndexStatus
a} :: IndexConfigurationSummary)

instance Data.FromJSON IndexConfigurationSummary where
  parseJSON :: Value -> Parser IndexConfigurationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IndexConfigurationSummary"
      ( \Object
x ->
          Maybe IndexEdition
-> Maybe Text
-> Maybe Text
-> POSIX
-> POSIX
-> IndexStatus
-> IndexConfigurationSummary
IndexConfigurationSummary'
            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
"Edition")
            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
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 a
Data..: Key
"UpdatedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Status")
      )

instance Prelude.Hashable IndexConfigurationSummary where
  hashWithSalt :: Int -> IndexConfigurationSummary -> Int
hashWithSalt Int
_salt IndexConfigurationSummary' {Maybe Text
Maybe IndexEdition
POSIX
IndexStatus
status :: IndexStatus
updatedAt :: POSIX
createdAt :: POSIX
name :: Maybe Text
id :: Maybe Text
edition :: Maybe IndexEdition
$sel:status:IndexConfigurationSummary' :: IndexConfigurationSummary -> IndexStatus
$sel:updatedAt:IndexConfigurationSummary' :: IndexConfigurationSummary -> POSIX
$sel:createdAt:IndexConfigurationSummary' :: IndexConfigurationSummary -> POSIX
$sel:name:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe Text
$sel:id:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe Text
$sel:edition:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe IndexEdition
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IndexEdition
edition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
updatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` IndexStatus
status

instance Prelude.NFData IndexConfigurationSummary where
  rnf :: IndexConfigurationSummary -> ()
rnf IndexConfigurationSummary' {Maybe Text
Maybe IndexEdition
POSIX
IndexStatus
status :: IndexStatus
updatedAt :: POSIX
createdAt :: POSIX
name :: Maybe Text
id :: Maybe Text
edition :: Maybe IndexEdition
$sel:status:IndexConfigurationSummary' :: IndexConfigurationSummary -> IndexStatus
$sel:updatedAt:IndexConfigurationSummary' :: IndexConfigurationSummary -> POSIX
$sel:createdAt:IndexConfigurationSummary' :: IndexConfigurationSummary -> POSIX
$sel:name:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe Text
$sel:id:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe Text
$sel:edition:IndexConfigurationSummary' :: IndexConfigurationSummary -> Maybe IndexEdition
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe IndexEdition
edition
      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
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
updatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf IndexStatus
status