{-# 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 #-}
module Amazonka.Kendra.Types.Document 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.ContentType
import Amazonka.Kendra.Types.DocumentAttribute
import Amazonka.Kendra.Types.HierarchicalPrincipal
import Amazonka.Kendra.Types.Principal
import Amazonka.Kendra.Types.S3Path
import qualified Amazonka.Prelude as Prelude
data Document = Document'
{
Document -> Maybe Text
accessControlConfigurationId :: Prelude.Maybe Prelude.Text,
Document -> Maybe [Principal]
accessControlList :: Prelude.Maybe [Principal],
Document -> Maybe [DocumentAttribute]
attributes :: Prelude.Maybe [DocumentAttribute],
Document -> Maybe Base64
blob :: Prelude.Maybe Data.Base64,
Document -> Maybe ContentType
contentType :: Prelude.Maybe ContentType,
Document -> Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList :: Prelude.Maybe (Prelude.NonEmpty HierarchicalPrincipal),
Document -> Maybe S3Path
s3Path :: Prelude.Maybe S3Path,
Document -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
Document -> Text
id :: Prelude.Text
}
deriving (Document -> Document -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Document -> Document -> Bool
$c/= :: Document -> Document -> Bool
== :: Document -> Document -> Bool
$c== :: Document -> Document -> Bool
Prelude.Eq, ReadPrec [Document]
ReadPrec Document
Int -> ReadS Document
ReadS [Document]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Document]
$creadListPrec :: ReadPrec [Document]
readPrec :: ReadPrec Document
$creadPrec :: ReadPrec Document
readList :: ReadS [Document]
$creadList :: ReadS [Document]
readsPrec :: Int -> ReadS Document
$creadsPrec :: Int -> ReadS Document
Prelude.Read, Int -> Document -> ShowS
[Document] -> ShowS
Document -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Document] -> ShowS
$cshowList :: [Document] -> ShowS
show :: Document -> String
$cshow :: Document -> String
showsPrec :: Int -> Document -> ShowS
$cshowsPrec :: Int -> Document -> ShowS
Prelude.Show, forall x. Rep Document x -> Document
forall x. Document -> Rep Document x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Document x -> Document
$cfrom :: forall x. Document -> Rep Document x
Prelude.Generic)
newDocument ::
Prelude.Text ->
Document
newDocument :: Text -> Document
newDocument Text
pId_ =
Document'
{ $sel:accessControlConfigurationId:Document' :: Maybe Text
accessControlConfigurationId =
forall a. Maybe a
Prelude.Nothing,
$sel:accessControlList:Document' :: Maybe [Principal]
accessControlList = forall a. Maybe a
Prelude.Nothing,
$sel:attributes:Document' :: Maybe [DocumentAttribute]
attributes = forall a. Maybe a
Prelude.Nothing,
$sel:blob:Document' :: Maybe Base64
blob = forall a. Maybe a
Prelude.Nothing,
$sel:contentType:Document' :: Maybe ContentType
contentType = forall a. Maybe a
Prelude.Nothing,
$sel:hierarchicalAccessControlList:Document' :: Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList = forall a. Maybe a
Prelude.Nothing,
$sel:s3Path:Document' :: Maybe S3Path
s3Path = forall a. Maybe a
Prelude.Nothing,
$sel:title:Document' :: Maybe Text
title = forall a. Maybe a
Prelude.Nothing,
$sel:id:Document' :: Text
id = Text
pId_
}
document_accessControlConfigurationId :: Lens.Lens' Document (Prelude.Maybe Prelude.Text)
document_accessControlConfigurationId :: Lens' Document (Maybe Text)
document_accessControlConfigurationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe Text
accessControlConfigurationId :: Maybe Text
$sel:accessControlConfigurationId:Document' :: Document -> Maybe Text
accessControlConfigurationId} -> Maybe Text
accessControlConfigurationId) (\s :: Document
s@Document' {} Maybe Text
a -> Document
s {$sel:accessControlConfigurationId:Document' :: Maybe Text
accessControlConfigurationId = Maybe Text
a} :: Document)
document_accessControlList :: Lens.Lens' Document (Prelude.Maybe [Principal])
document_accessControlList :: Lens' Document (Maybe [Principal])
document_accessControlList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe [Principal]
accessControlList :: Maybe [Principal]
$sel:accessControlList:Document' :: Document -> Maybe [Principal]
accessControlList} -> Maybe [Principal]
accessControlList) (\s :: Document
s@Document' {} Maybe [Principal]
a -> Document
s {$sel:accessControlList:Document' :: Maybe [Principal]
accessControlList = Maybe [Principal]
a} :: Document) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
document_attributes :: Lens.Lens' Document (Prelude.Maybe [DocumentAttribute])
document_attributes :: Lens' Document (Maybe [DocumentAttribute])
document_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe [DocumentAttribute]
attributes :: Maybe [DocumentAttribute]
$sel:attributes:Document' :: Document -> Maybe [DocumentAttribute]
attributes} -> Maybe [DocumentAttribute]
attributes) (\s :: Document
s@Document' {} Maybe [DocumentAttribute]
a -> Document
s {$sel:attributes:Document' :: Maybe [DocumentAttribute]
attributes = Maybe [DocumentAttribute]
a} :: Document) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
document_blob :: Lens.Lens' Document (Prelude.Maybe Prelude.ByteString)
document_blob :: Lens' Document (Maybe ByteString)
document_blob = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe Base64
blob :: Maybe Base64
$sel:blob:Document' :: Document -> Maybe Base64
blob} -> Maybe Base64
blob) (\s :: Document
s@Document' {} Maybe Base64
a -> Document
s {$sel:blob:Document' :: Maybe Base64
blob = Maybe Base64
a} :: Document) 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 Iso' Base64 ByteString
Data._Base64
document_contentType :: Lens.Lens' Document (Prelude.Maybe ContentType)
document_contentType :: Lens' Document (Maybe ContentType)
document_contentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe ContentType
contentType :: Maybe ContentType
$sel:contentType:Document' :: Document -> Maybe ContentType
contentType} -> Maybe ContentType
contentType) (\s :: Document
s@Document' {} Maybe ContentType
a -> Document
s {$sel:contentType:Document' :: Maybe ContentType
contentType = Maybe ContentType
a} :: Document)
document_hierarchicalAccessControlList :: Lens.Lens' Document (Prelude.Maybe (Prelude.NonEmpty HierarchicalPrincipal))
document_hierarchicalAccessControlList :: Lens' Document (Maybe (NonEmpty HierarchicalPrincipal))
document_hierarchicalAccessControlList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList :: Maybe (NonEmpty HierarchicalPrincipal)
$sel:hierarchicalAccessControlList:Document' :: Document -> Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList} -> Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList) (\s :: Document
s@Document' {} Maybe (NonEmpty HierarchicalPrincipal)
a -> Document
s {$sel:hierarchicalAccessControlList:Document' :: Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList = Maybe (NonEmpty HierarchicalPrincipal)
a} :: Document) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
document_s3Path :: Lens.Lens' Document (Prelude.Maybe S3Path)
document_s3Path :: Lens' Document (Maybe S3Path)
document_s3Path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe S3Path
s3Path :: Maybe S3Path
$sel:s3Path:Document' :: Document -> Maybe S3Path
s3Path} -> Maybe S3Path
s3Path) (\s :: Document
s@Document' {} Maybe S3Path
a -> Document
s {$sel:s3Path:Document' :: Maybe S3Path
s3Path = Maybe S3Path
a} :: Document)
document_title :: Lens.Lens' Document (Prelude.Maybe Prelude.Text)
document_title :: Lens' Document (Maybe Text)
document_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Maybe Text
title :: Maybe Text
$sel:title:Document' :: Document -> Maybe Text
title} -> Maybe Text
title) (\s :: Document
s@Document' {} Maybe Text
a -> Document
s {$sel:title:Document' :: Maybe Text
title = Maybe Text
a} :: Document)
document_id :: Lens.Lens' Document Prelude.Text
document_id :: Lens' Document Text
document_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Document' {Text
id :: Text
$sel:id:Document' :: Document -> Text
id} -> Text
id) (\s :: Document
s@Document' {} Text
a -> Document
s {$sel:id:Document' :: Text
id = Text
a} :: Document)
instance Prelude.Hashable Document where
hashWithSalt :: Int -> Document -> Int
hashWithSalt Int
_salt Document' {Maybe [DocumentAttribute]
Maybe [Principal]
Maybe (NonEmpty HierarchicalPrincipal)
Maybe Text
Maybe Base64
Maybe ContentType
Maybe S3Path
Text
id :: Text
title :: Maybe Text
s3Path :: Maybe S3Path
hierarchicalAccessControlList :: Maybe (NonEmpty HierarchicalPrincipal)
contentType :: Maybe ContentType
blob :: Maybe Base64
attributes :: Maybe [DocumentAttribute]
accessControlList :: Maybe [Principal]
accessControlConfigurationId :: Maybe Text
$sel:id:Document' :: Document -> Text
$sel:title:Document' :: Document -> Maybe Text
$sel:s3Path:Document' :: Document -> Maybe S3Path
$sel:hierarchicalAccessControlList:Document' :: Document -> Maybe (NonEmpty HierarchicalPrincipal)
$sel:contentType:Document' :: Document -> Maybe ContentType
$sel:blob:Document' :: Document -> Maybe Base64
$sel:attributes:Document' :: Document -> Maybe [DocumentAttribute]
$sel:accessControlList:Document' :: Document -> Maybe [Principal]
$sel:accessControlConfigurationId:Document' :: Document -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accessControlConfigurationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Principal]
accessControlList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DocumentAttribute]
attributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Base64
blob
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContentType
contentType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Path
s3Path
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
title
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData Document where
rnf :: Document -> ()
rnf Document' {Maybe [DocumentAttribute]
Maybe [Principal]
Maybe (NonEmpty HierarchicalPrincipal)
Maybe Text
Maybe Base64
Maybe ContentType
Maybe S3Path
Text
id :: Text
title :: Maybe Text
s3Path :: Maybe S3Path
hierarchicalAccessControlList :: Maybe (NonEmpty HierarchicalPrincipal)
contentType :: Maybe ContentType
blob :: Maybe Base64
attributes :: Maybe [DocumentAttribute]
accessControlList :: Maybe [Principal]
accessControlConfigurationId :: Maybe Text
$sel:id:Document' :: Document -> Text
$sel:title:Document' :: Document -> Maybe Text
$sel:s3Path:Document' :: Document -> Maybe S3Path
$sel:hierarchicalAccessControlList:Document' :: Document -> Maybe (NonEmpty HierarchicalPrincipal)
$sel:contentType:Document' :: Document -> Maybe ContentType
$sel:blob:Document' :: Document -> Maybe Base64
$sel:attributes:Document' :: Document -> Maybe [DocumentAttribute]
$sel:accessControlList:Document' :: Document -> Maybe [Principal]
$sel:accessControlConfigurationId:Document' :: Document -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accessControlConfigurationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Principal]
accessControlList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DocumentAttribute]
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Base64
blob
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContentType
contentType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Path
s3Path
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
title
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToJSON Document where
toJSON :: Document -> Value
toJSON Document' {Maybe [DocumentAttribute]
Maybe [Principal]
Maybe (NonEmpty HierarchicalPrincipal)
Maybe Text
Maybe Base64
Maybe ContentType
Maybe S3Path
Text
id :: Text
title :: Maybe Text
s3Path :: Maybe S3Path
hierarchicalAccessControlList :: Maybe (NonEmpty HierarchicalPrincipal)
contentType :: Maybe ContentType
blob :: Maybe Base64
attributes :: Maybe [DocumentAttribute]
accessControlList :: Maybe [Principal]
accessControlConfigurationId :: Maybe Text
$sel:id:Document' :: Document -> Text
$sel:title:Document' :: Document -> Maybe Text
$sel:s3Path:Document' :: Document -> Maybe S3Path
$sel:hierarchicalAccessControlList:Document' :: Document -> Maybe (NonEmpty HierarchicalPrincipal)
$sel:contentType:Document' :: Document -> Maybe ContentType
$sel:blob:Document' :: Document -> Maybe Base64
$sel:attributes:Document' :: Document -> Maybe [DocumentAttribute]
$sel:accessControlList:Document' :: Document -> Maybe [Principal]
$sel:accessControlConfigurationId:Document' :: Document -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AccessControlConfigurationId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accessControlConfigurationId,
(Key
"AccessControlList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Principal]
accessControlList,
(Key
"Attributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DocumentAttribute]
attributes,
(Key
"Blob" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
blob,
(Key
"ContentType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContentType
contentType,
(Key
"HierarchicalAccessControlList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty HierarchicalPrincipal)
hierarchicalAccessControlList,
(Key
"S3Path" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Path
s3Path,
(Key
"Title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
title,
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
]
)