{-# 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.DataSourceGroup
-- 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.DataSourceGroup 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

-- | Data source information for user context filtering.
--
-- /See:/ 'newDataSourceGroup' smart constructor.
data DataSourceGroup = DataSourceGroup'
  { -- | The identifier of the group you want to add to your list of groups. This
    -- is for filtering search results based on the groups\' access to
    -- documents.
    DataSourceGroup -> Text
groupId :: Prelude.Text,
    -- | The identifier of the data source group you want to add to your list of
    -- data source groups. This is for filtering search results based on the
    -- groups\' access to documents in that data source.
    DataSourceGroup -> Text
dataSourceId :: Prelude.Text
  }
  deriving (DataSourceGroup -> DataSourceGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSourceGroup -> DataSourceGroup -> Bool
$c/= :: DataSourceGroup -> DataSourceGroup -> Bool
== :: DataSourceGroup -> DataSourceGroup -> Bool
$c== :: DataSourceGroup -> DataSourceGroup -> Bool
Prelude.Eq, ReadPrec [DataSourceGroup]
ReadPrec DataSourceGroup
Int -> ReadS DataSourceGroup
ReadS [DataSourceGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSourceGroup]
$creadListPrec :: ReadPrec [DataSourceGroup]
readPrec :: ReadPrec DataSourceGroup
$creadPrec :: ReadPrec DataSourceGroup
readList :: ReadS [DataSourceGroup]
$creadList :: ReadS [DataSourceGroup]
readsPrec :: Int -> ReadS DataSourceGroup
$creadsPrec :: Int -> ReadS DataSourceGroup
Prelude.Read, Int -> DataSourceGroup -> ShowS
[DataSourceGroup] -> ShowS
DataSourceGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSourceGroup] -> ShowS
$cshowList :: [DataSourceGroup] -> ShowS
show :: DataSourceGroup -> String
$cshow :: DataSourceGroup -> String
showsPrec :: Int -> DataSourceGroup -> ShowS
$cshowsPrec :: Int -> DataSourceGroup -> ShowS
Prelude.Show, forall x. Rep DataSourceGroup x -> DataSourceGroup
forall x. DataSourceGroup -> Rep DataSourceGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSourceGroup x -> DataSourceGroup
$cfrom :: forall x. DataSourceGroup -> Rep DataSourceGroup x
Prelude.Generic)

-- |
-- Create a value of 'DataSourceGroup' 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:
--
-- 'groupId', 'dataSourceGroup_groupId' - The identifier of the group you want to add to your list of groups. This
-- is for filtering search results based on the groups\' access to
-- documents.
--
-- 'dataSourceId', 'dataSourceGroup_dataSourceId' - The identifier of the data source group you want to add to your list of
-- data source groups. This is for filtering search results based on the
-- groups\' access to documents in that data source.
newDataSourceGroup ::
  -- | 'groupId'
  Prelude.Text ->
  -- | 'dataSourceId'
  Prelude.Text ->
  DataSourceGroup
newDataSourceGroup :: Text -> Text -> DataSourceGroup
newDataSourceGroup Text
pGroupId_ Text
pDataSourceId_ =
  DataSourceGroup'
    { $sel:groupId:DataSourceGroup' :: Text
groupId = Text
pGroupId_,
      $sel:dataSourceId:DataSourceGroup' :: Text
dataSourceId = Text
pDataSourceId_
    }

-- | The identifier of the group you want to add to your list of groups. This
-- is for filtering search results based on the groups\' access to
-- documents.
dataSourceGroup_groupId :: Lens.Lens' DataSourceGroup Prelude.Text
dataSourceGroup_groupId :: Lens' DataSourceGroup Text
dataSourceGroup_groupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceGroup' {Text
groupId :: Text
$sel:groupId:DataSourceGroup' :: DataSourceGroup -> Text
groupId} -> Text
groupId) (\s :: DataSourceGroup
s@DataSourceGroup' {} Text
a -> DataSourceGroup
s {$sel:groupId:DataSourceGroup' :: Text
groupId = Text
a} :: DataSourceGroup)

-- | The identifier of the data source group you want to add to your list of
-- data source groups. This is for filtering search results based on the
-- groups\' access to documents in that data source.
dataSourceGroup_dataSourceId :: Lens.Lens' DataSourceGroup Prelude.Text
dataSourceGroup_dataSourceId :: Lens' DataSourceGroup Text
dataSourceGroup_dataSourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceGroup' {Text
dataSourceId :: Text
$sel:dataSourceId:DataSourceGroup' :: DataSourceGroup -> Text
dataSourceId} -> Text
dataSourceId) (\s :: DataSourceGroup
s@DataSourceGroup' {} Text
a -> DataSourceGroup
s {$sel:dataSourceId:DataSourceGroup' :: Text
dataSourceId = Text
a} :: DataSourceGroup)

instance Prelude.Hashable DataSourceGroup where
  hashWithSalt :: Int -> DataSourceGroup -> Int
hashWithSalt Int
_salt DataSourceGroup' {Text
dataSourceId :: Text
groupId :: Text
$sel:dataSourceId:DataSourceGroup' :: DataSourceGroup -> Text
$sel:groupId:DataSourceGroup' :: DataSourceGroup -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSourceId

instance Prelude.NFData DataSourceGroup where
  rnf :: DataSourceGroup -> ()
rnf DataSourceGroup' {Text
dataSourceId :: Text
groupId :: Text
$sel:dataSourceId:DataSourceGroup' :: DataSourceGroup -> Text
$sel:groupId:DataSourceGroup' :: DataSourceGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
groupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dataSourceId

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