{-# 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.AclConfiguration
-- 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.AclConfiguration 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 information about the column that should be used for filtering
-- the query response by groups.
--
-- /See:/ 'newAclConfiguration' smart constructor.
data AclConfiguration = AclConfiguration'
  { -- | A list of groups, separated by semi-colons, that filters a query
    -- response based on user context. The document is only returned to users
    -- that are in one of the groups specified in the @UserContext@ field of
    -- the @Query@ API.
    AclConfiguration -> Text
allowedGroupsColumnName :: Prelude.Text
  }
  deriving (AclConfiguration -> AclConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AclConfiguration -> AclConfiguration -> Bool
$c/= :: AclConfiguration -> AclConfiguration -> Bool
== :: AclConfiguration -> AclConfiguration -> Bool
$c== :: AclConfiguration -> AclConfiguration -> Bool
Prelude.Eq, ReadPrec [AclConfiguration]
ReadPrec AclConfiguration
Int -> ReadS AclConfiguration
ReadS [AclConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AclConfiguration]
$creadListPrec :: ReadPrec [AclConfiguration]
readPrec :: ReadPrec AclConfiguration
$creadPrec :: ReadPrec AclConfiguration
readList :: ReadS [AclConfiguration]
$creadList :: ReadS [AclConfiguration]
readsPrec :: Int -> ReadS AclConfiguration
$creadsPrec :: Int -> ReadS AclConfiguration
Prelude.Read, Int -> AclConfiguration -> ShowS
[AclConfiguration] -> ShowS
AclConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AclConfiguration] -> ShowS
$cshowList :: [AclConfiguration] -> ShowS
show :: AclConfiguration -> String
$cshow :: AclConfiguration -> String
showsPrec :: Int -> AclConfiguration -> ShowS
$cshowsPrec :: Int -> AclConfiguration -> ShowS
Prelude.Show, forall x. Rep AclConfiguration x -> AclConfiguration
forall x. AclConfiguration -> Rep AclConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AclConfiguration x -> AclConfiguration
$cfrom :: forall x. AclConfiguration -> Rep AclConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AclConfiguration' 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:
--
-- 'allowedGroupsColumnName', 'aclConfiguration_allowedGroupsColumnName' - A list of groups, separated by semi-colons, that filters a query
-- response based on user context. The document is only returned to users
-- that are in one of the groups specified in the @UserContext@ field of
-- the @Query@ API.
newAclConfiguration ::
  -- | 'allowedGroupsColumnName'
  Prelude.Text ->
  AclConfiguration
newAclConfiguration :: Text -> AclConfiguration
newAclConfiguration Text
pAllowedGroupsColumnName_ =
  AclConfiguration'
    { $sel:allowedGroupsColumnName:AclConfiguration' :: Text
allowedGroupsColumnName =
        Text
pAllowedGroupsColumnName_
    }

-- | A list of groups, separated by semi-colons, that filters a query
-- response based on user context. The document is only returned to users
-- that are in one of the groups specified in the @UserContext@ field of
-- the @Query@ API.
aclConfiguration_allowedGroupsColumnName :: Lens.Lens' AclConfiguration Prelude.Text
aclConfiguration_allowedGroupsColumnName :: Lens' AclConfiguration Text
aclConfiguration_allowedGroupsColumnName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AclConfiguration' {Text
allowedGroupsColumnName :: Text
$sel:allowedGroupsColumnName:AclConfiguration' :: AclConfiguration -> Text
allowedGroupsColumnName} -> Text
allowedGroupsColumnName) (\s :: AclConfiguration
s@AclConfiguration' {} Text
a -> AclConfiguration
s {$sel:allowedGroupsColumnName:AclConfiguration' :: Text
allowedGroupsColumnName = Text
a} :: AclConfiguration)

instance Data.FromJSON AclConfiguration where
  parseJSON :: Value -> Parser AclConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AclConfiguration"
      ( \Object
x ->
          Text -> AclConfiguration
AclConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AllowedGroupsColumnName")
      )

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

instance Prelude.NFData AclConfiguration where
  rnf :: AclConfiguration -> ()
rnf AclConfiguration' {Text
allowedGroupsColumnName :: Text
$sel:allowedGroupsColumnName:AclConfiguration' :: AclConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
allowedGroupsColumnName

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