{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Kendra.PutPrincipalMapping
(
PutPrincipalMapping (..),
newPutPrincipalMapping,
putPrincipalMapping_dataSourceId,
putPrincipalMapping_orderingId,
putPrincipalMapping_roleArn,
putPrincipalMapping_indexId,
putPrincipalMapping_groupId,
putPrincipalMapping_groupMembers,
PutPrincipalMappingResponse (..),
newPutPrincipalMappingResponse,
)
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutPrincipalMapping = PutPrincipalMapping'
{
PutPrincipalMapping -> Maybe Text
dataSourceId :: Prelude.Maybe Prelude.Text,
PutPrincipalMapping -> Maybe Natural
orderingId :: Prelude.Maybe Prelude.Natural,
PutPrincipalMapping -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
PutPrincipalMapping -> Text
indexId :: Prelude.Text,
PutPrincipalMapping -> Text
groupId :: Prelude.Text,
PutPrincipalMapping -> GroupMembers
groupMembers :: GroupMembers
}
deriving (PutPrincipalMapping -> PutPrincipalMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPrincipalMapping -> PutPrincipalMapping -> Bool
$c/= :: PutPrincipalMapping -> PutPrincipalMapping -> Bool
== :: PutPrincipalMapping -> PutPrincipalMapping -> Bool
$c== :: PutPrincipalMapping -> PutPrincipalMapping -> Bool
Prelude.Eq, ReadPrec [PutPrincipalMapping]
ReadPrec PutPrincipalMapping
Int -> ReadS PutPrincipalMapping
ReadS [PutPrincipalMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPrincipalMapping]
$creadListPrec :: ReadPrec [PutPrincipalMapping]
readPrec :: ReadPrec PutPrincipalMapping
$creadPrec :: ReadPrec PutPrincipalMapping
readList :: ReadS [PutPrincipalMapping]
$creadList :: ReadS [PutPrincipalMapping]
readsPrec :: Int -> ReadS PutPrincipalMapping
$creadsPrec :: Int -> ReadS PutPrincipalMapping
Prelude.Read, Int -> PutPrincipalMapping -> ShowS
[PutPrincipalMapping] -> ShowS
PutPrincipalMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPrincipalMapping] -> ShowS
$cshowList :: [PutPrincipalMapping] -> ShowS
show :: PutPrincipalMapping -> String
$cshow :: PutPrincipalMapping -> String
showsPrec :: Int -> PutPrincipalMapping -> ShowS
$cshowsPrec :: Int -> PutPrincipalMapping -> ShowS
Prelude.Show, forall x. Rep PutPrincipalMapping x -> PutPrincipalMapping
forall x. PutPrincipalMapping -> Rep PutPrincipalMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPrincipalMapping x -> PutPrincipalMapping
$cfrom :: forall x. PutPrincipalMapping -> Rep PutPrincipalMapping x
Prelude.Generic)
newPutPrincipalMapping ::
Prelude.Text ->
Prelude.Text ->
GroupMembers ->
PutPrincipalMapping
newPutPrincipalMapping :: Text -> Text -> GroupMembers -> PutPrincipalMapping
newPutPrincipalMapping
Text
pIndexId_
Text
pGroupId_
GroupMembers
pGroupMembers_ =
PutPrincipalMapping'
{ $sel:dataSourceId:PutPrincipalMapping' :: Maybe Text
dataSourceId =
forall a. Maybe a
Prelude.Nothing,
$sel:orderingId:PutPrincipalMapping' :: Maybe Natural
orderingId = forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:PutPrincipalMapping' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
$sel:indexId:PutPrincipalMapping' :: Text
indexId = Text
pIndexId_,
$sel:groupId:PutPrincipalMapping' :: Text
groupId = Text
pGroupId_,
$sel:groupMembers:PutPrincipalMapping' :: GroupMembers
groupMembers = GroupMembers
pGroupMembers_
}
putPrincipalMapping_dataSourceId :: Lens.Lens' PutPrincipalMapping (Prelude.Maybe Prelude.Text)
putPrincipalMapping_dataSourceId :: Lens' PutPrincipalMapping (Maybe Text)
putPrincipalMapping_dataSourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPrincipalMapping' {Maybe Text
dataSourceId :: Maybe Text
$sel:dataSourceId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
dataSourceId} -> Maybe Text
dataSourceId) (\s :: PutPrincipalMapping
s@PutPrincipalMapping' {} Maybe Text
a -> PutPrincipalMapping
s {$sel:dataSourceId:PutPrincipalMapping' :: Maybe Text
dataSourceId = Maybe Text
a} :: PutPrincipalMapping)
putPrincipalMapping_orderingId :: Lens.Lens' PutPrincipalMapping (Prelude.Maybe Prelude.Natural)
putPrincipalMapping_orderingId :: Lens' PutPrincipalMapping (Maybe Natural)
putPrincipalMapping_orderingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPrincipalMapping' {Maybe Natural
orderingId :: Maybe Natural
$sel:orderingId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Natural
orderingId} -> Maybe Natural
orderingId) (\s :: PutPrincipalMapping
s@PutPrincipalMapping' {} Maybe Natural
a -> PutPrincipalMapping
s {$sel:orderingId:PutPrincipalMapping' :: Maybe Natural
orderingId = Maybe Natural
a} :: PutPrincipalMapping)
putPrincipalMapping_roleArn :: Lens.Lens' PutPrincipalMapping (Prelude.Maybe Prelude.Text)
putPrincipalMapping_roleArn :: Lens' PutPrincipalMapping (Maybe Text)
putPrincipalMapping_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPrincipalMapping' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: PutPrincipalMapping
s@PutPrincipalMapping' {} Maybe Text
a -> PutPrincipalMapping
s {$sel:roleArn:PutPrincipalMapping' :: Maybe Text
roleArn = Maybe Text
a} :: PutPrincipalMapping)
putPrincipalMapping_indexId :: Lens.Lens' PutPrincipalMapping Prelude.Text
putPrincipalMapping_indexId :: Lens' PutPrincipalMapping Text
putPrincipalMapping_indexId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPrincipalMapping' {Text
indexId :: Text
$sel:indexId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
indexId} -> Text
indexId) (\s :: PutPrincipalMapping
s@PutPrincipalMapping' {} Text
a -> PutPrincipalMapping
s {$sel:indexId:PutPrincipalMapping' :: Text
indexId = Text
a} :: PutPrincipalMapping)
putPrincipalMapping_groupId :: Lens.Lens' PutPrincipalMapping Prelude.Text
putPrincipalMapping_groupId :: Lens' PutPrincipalMapping Text
putPrincipalMapping_groupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPrincipalMapping' {Text
groupId :: Text
$sel:groupId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
groupId} -> Text
groupId) (\s :: PutPrincipalMapping
s@PutPrincipalMapping' {} Text
a -> PutPrincipalMapping
s {$sel:groupId:PutPrincipalMapping' :: Text
groupId = Text
a} :: PutPrincipalMapping)
putPrincipalMapping_groupMembers :: Lens.Lens' PutPrincipalMapping GroupMembers
putPrincipalMapping_groupMembers :: Lens' PutPrincipalMapping GroupMembers
putPrincipalMapping_groupMembers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPrincipalMapping' {GroupMembers
groupMembers :: GroupMembers
$sel:groupMembers:PutPrincipalMapping' :: PutPrincipalMapping -> GroupMembers
groupMembers} -> GroupMembers
groupMembers) (\s :: PutPrincipalMapping
s@PutPrincipalMapping' {} GroupMembers
a -> PutPrincipalMapping
s {$sel:groupMembers:PutPrincipalMapping' :: GroupMembers
groupMembers = GroupMembers
a} :: PutPrincipalMapping)
instance Core.AWSRequest PutPrincipalMapping where
type
AWSResponse PutPrincipalMapping =
PutPrincipalMappingResponse
request :: (Service -> Service)
-> PutPrincipalMapping -> Request PutPrincipalMapping
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutPrincipalMapping
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutPrincipalMapping)))
response =
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull PutPrincipalMappingResponse
PutPrincipalMappingResponse'
instance Prelude.Hashable PutPrincipalMapping where
hashWithSalt :: Int -> PutPrincipalMapping -> Int
hashWithSalt Int
_salt PutPrincipalMapping' {Maybe Natural
Maybe Text
Text
GroupMembers
groupMembers :: GroupMembers
groupId :: Text
indexId :: Text
roleArn :: Maybe Text
orderingId :: Maybe Natural
dataSourceId :: Maybe Text
$sel:groupMembers:PutPrincipalMapping' :: PutPrincipalMapping -> GroupMembers
$sel:groupId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
$sel:indexId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
$sel:roleArn:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
$sel:orderingId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Natural
$sel:dataSourceId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataSourceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
orderingId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
indexId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GroupMembers
groupMembers
instance Prelude.NFData PutPrincipalMapping where
rnf :: PutPrincipalMapping -> ()
rnf PutPrincipalMapping' {Maybe Natural
Maybe Text
Text
GroupMembers
groupMembers :: GroupMembers
groupId :: Text
indexId :: Text
roleArn :: Maybe Text
orderingId :: Maybe Natural
dataSourceId :: Maybe Text
$sel:groupMembers:PutPrincipalMapping' :: PutPrincipalMapping -> GroupMembers
$sel:groupId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
$sel:indexId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
$sel:roleArn:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
$sel:orderingId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Natural
$sel:dataSourceId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataSourceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
orderingId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
indexId
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 GroupMembers
groupMembers
instance Data.ToHeaders PutPrincipalMapping where
toHeaders :: PutPrincipalMapping -> [Header]
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"AWSKendraFrontendService.PutPrincipalMapping" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON PutPrincipalMapping where
toJSON :: PutPrincipalMapping -> Value
toJSON PutPrincipalMapping' {Maybe Natural
Maybe Text
Text
GroupMembers
groupMembers :: GroupMembers
groupId :: Text
indexId :: Text
roleArn :: Maybe Text
orderingId :: Maybe Natural
dataSourceId :: Maybe Text
$sel:groupMembers:PutPrincipalMapping' :: PutPrincipalMapping -> GroupMembers
$sel:groupId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
$sel:indexId:PutPrincipalMapping' :: PutPrincipalMapping -> Text
$sel:roleArn:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
$sel:orderingId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Natural
$sel:dataSourceId:PutPrincipalMapping' :: PutPrincipalMapping -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DataSourceId" 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
dataSourceId,
(Key
"OrderingId" 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 Natural
orderingId,
(Key
"RoleArn" 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
roleArn,
forall a. a -> Maybe a
Prelude.Just (Key
"IndexId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
indexId),
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
"GroupMembers" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GroupMembers
groupMembers)
]
)
instance Data.ToPath PutPrincipalMapping where
toPath :: PutPrincipalMapping -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutPrincipalMapping where
toQuery :: PutPrincipalMapping -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutPrincipalMappingResponse = PutPrincipalMappingResponse'
{
}
deriving (PutPrincipalMappingResponse -> PutPrincipalMappingResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPrincipalMappingResponse -> PutPrincipalMappingResponse -> Bool
$c/= :: PutPrincipalMappingResponse -> PutPrincipalMappingResponse -> Bool
== :: PutPrincipalMappingResponse -> PutPrincipalMappingResponse -> Bool
$c== :: PutPrincipalMappingResponse -> PutPrincipalMappingResponse -> Bool
Prelude.Eq, ReadPrec [PutPrincipalMappingResponse]
ReadPrec PutPrincipalMappingResponse
Int -> ReadS PutPrincipalMappingResponse
ReadS [PutPrincipalMappingResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPrincipalMappingResponse]
$creadListPrec :: ReadPrec [PutPrincipalMappingResponse]
readPrec :: ReadPrec PutPrincipalMappingResponse
$creadPrec :: ReadPrec PutPrincipalMappingResponse
readList :: ReadS [PutPrincipalMappingResponse]
$creadList :: ReadS [PutPrincipalMappingResponse]
readsPrec :: Int -> ReadS PutPrincipalMappingResponse
$creadsPrec :: Int -> ReadS PutPrincipalMappingResponse
Prelude.Read, Int -> PutPrincipalMappingResponse -> ShowS
[PutPrincipalMappingResponse] -> ShowS
PutPrincipalMappingResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPrincipalMappingResponse] -> ShowS
$cshowList :: [PutPrincipalMappingResponse] -> ShowS
show :: PutPrincipalMappingResponse -> String
$cshow :: PutPrincipalMappingResponse -> String
showsPrec :: Int -> PutPrincipalMappingResponse -> ShowS
$cshowsPrec :: Int -> PutPrincipalMappingResponse -> ShowS
Prelude.Show, forall x.
Rep PutPrincipalMappingResponse x -> PutPrincipalMappingResponse
forall x.
PutPrincipalMappingResponse -> Rep PutPrincipalMappingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutPrincipalMappingResponse x -> PutPrincipalMappingResponse
$cfrom :: forall x.
PutPrincipalMappingResponse -> Rep PutPrincipalMappingResponse x
Prelude.Generic)
newPutPrincipalMappingResponse ::
PutPrincipalMappingResponse
newPutPrincipalMappingResponse :: PutPrincipalMappingResponse
newPutPrincipalMappingResponse =
PutPrincipalMappingResponse
PutPrincipalMappingResponse'
instance Prelude.NFData PutPrincipalMappingResponse where
rnf :: PutPrincipalMappingResponse -> ()
rnf PutPrincipalMappingResponse
_ = ()