{-# 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.CloudDirectory.AttachToIndex
(
AttachToIndex (..),
newAttachToIndex,
attachToIndex_directoryArn,
attachToIndex_indexReference,
attachToIndex_targetReference,
AttachToIndexResponse (..),
newAttachToIndexResponse,
attachToIndexResponse_attachedObjectIdentifier,
attachToIndexResponse_httpStatus,
)
where
import Amazonka.CloudDirectory.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AttachToIndex = AttachToIndex'
{
AttachToIndex -> Text
directoryArn :: Prelude.Text,
AttachToIndex -> ObjectReference
indexReference :: ObjectReference,
AttachToIndex -> ObjectReference
targetReference :: ObjectReference
}
deriving (AttachToIndex -> AttachToIndex -> Bool
(AttachToIndex -> AttachToIndex -> Bool)
-> (AttachToIndex -> AttachToIndex -> Bool) -> Eq AttachToIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachToIndex -> AttachToIndex -> Bool
$c/= :: AttachToIndex -> AttachToIndex -> Bool
== :: AttachToIndex -> AttachToIndex -> Bool
$c== :: AttachToIndex -> AttachToIndex -> Bool
Prelude.Eq, ReadPrec [AttachToIndex]
ReadPrec AttachToIndex
Int -> ReadS AttachToIndex
ReadS [AttachToIndex]
(Int -> ReadS AttachToIndex)
-> ReadS [AttachToIndex]
-> ReadPrec AttachToIndex
-> ReadPrec [AttachToIndex]
-> Read AttachToIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachToIndex]
$creadListPrec :: ReadPrec [AttachToIndex]
readPrec :: ReadPrec AttachToIndex
$creadPrec :: ReadPrec AttachToIndex
readList :: ReadS [AttachToIndex]
$creadList :: ReadS [AttachToIndex]
readsPrec :: Int -> ReadS AttachToIndex
$creadsPrec :: Int -> ReadS AttachToIndex
Prelude.Read, Int -> AttachToIndex -> ShowS
[AttachToIndex] -> ShowS
AttachToIndex -> String
(Int -> AttachToIndex -> ShowS)
-> (AttachToIndex -> String)
-> ([AttachToIndex] -> ShowS)
-> Show AttachToIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachToIndex] -> ShowS
$cshowList :: [AttachToIndex] -> ShowS
show :: AttachToIndex -> String
$cshow :: AttachToIndex -> String
showsPrec :: Int -> AttachToIndex -> ShowS
$cshowsPrec :: Int -> AttachToIndex -> ShowS
Prelude.Show, (forall x. AttachToIndex -> Rep AttachToIndex x)
-> (forall x. Rep AttachToIndex x -> AttachToIndex)
-> Generic AttachToIndex
forall x. Rep AttachToIndex x -> AttachToIndex
forall x. AttachToIndex -> Rep AttachToIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachToIndex x -> AttachToIndex
$cfrom :: forall x. AttachToIndex -> Rep AttachToIndex x
Prelude.Generic)
newAttachToIndex ::
Prelude.Text ->
ObjectReference ->
ObjectReference ->
AttachToIndex
newAttachToIndex :: Text -> ObjectReference -> ObjectReference -> AttachToIndex
newAttachToIndex
Text
pDirectoryArn_
ObjectReference
pIndexReference_
ObjectReference
pTargetReference_ =
AttachToIndex' :: Text -> ObjectReference -> ObjectReference -> AttachToIndex
AttachToIndex'
{ $sel:directoryArn:AttachToIndex' :: Text
directoryArn = Text
pDirectoryArn_,
$sel:indexReference:AttachToIndex' :: ObjectReference
indexReference = ObjectReference
pIndexReference_,
$sel:targetReference:AttachToIndex' :: ObjectReference
targetReference = ObjectReference
pTargetReference_
}
attachToIndex_directoryArn :: Lens.Lens' AttachToIndex Prelude.Text
attachToIndex_directoryArn :: (Text -> f Text) -> AttachToIndex -> f AttachToIndex
attachToIndex_directoryArn = (AttachToIndex -> Text)
-> (AttachToIndex -> Text -> AttachToIndex)
-> Lens AttachToIndex AttachToIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachToIndex' {Text
directoryArn :: Text
$sel:directoryArn:AttachToIndex' :: AttachToIndex -> Text
directoryArn} -> Text
directoryArn) (\s :: AttachToIndex
s@AttachToIndex' {} Text
a -> AttachToIndex
s {$sel:directoryArn:AttachToIndex' :: Text
directoryArn = Text
a} :: AttachToIndex)
attachToIndex_indexReference :: Lens.Lens' AttachToIndex ObjectReference
attachToIndex_indexReference :: (ObjectReference -> f ObjectReference)
-> AttachToIndex -> f AttachToIndex
attachToIndex_indexReference = (AttachToIndex -> ObjectReference)
-> (AttachToIndex -> ObjectReference -> AttachToIndex)
-> Lens AttachToIndex AttachToIndex ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachToIndex' {ObjectReference
indexReference :: ObjectReference
$sel:indexReference:AttachToIndex' :: AttachToIndex -> ObjectReference
indexReference} -> ObjectReference
indexReference) (\s :: AttachToIndex
s@AttachToIndex' {} ObjectReference
a -> AttachToIndex
s {$sel:indexReference:AttachToIndex' :: ObjectReference
indexReference = ObjectReference
a} :: AttachToIndex)
attachToIndex_targetReference :: Lens.Lens' AttachToIndex ObjectReference
attachToIndex_targetReference :: (ObjectReference -> f ObjectReference)
-> AttachToIndex -> f AttachToIndex
attachToIndex_targetReference = (AttachToIndex -> ObjectReference)
-> (AttachToIndex -> ObjectReference -> AttachToIndex)
-> Lens AttachToIndex AttachToIndex ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachToIndex' {ObjectReference
targetReference :: ObjectReference
$sel:targetReference:AttachToIndex' :: AttachToIndex -> ObjectReference
targetReference} -> ObjectReference
targetReference) (\s :: AttachToIndex
s@AttachToIndex' {} ObjectReference
a -> AttachToIndex
s {$sel:targetReference:AttachToIndex' :: ObjectReference
targetReference = ObjectReference
a} :: AttachToIndex)
instance Core.AWSRequest AttachToIndex where
type
AWSResponse AttachToIndex =
AttachToIndexResponse
request :: AttachToIndex -> Request AttachToIndex
request = Service -> AttachToIndex -> Request AttachToIndex
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AttachToIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachToIndex)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AttachToIndex))
-> Logger
-> Service
-> Proxy AttachToIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachToIndex)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> AttachToIndexResponse
AttachToIndexResponse'
(Maybe Text -> Int -> AttachToIndexResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AttachToIndexResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AttachedObjectIdentifier")
Either String (Int -> AttachToIndexResponse)
-> Either String Int -> Either String AttachToIndexResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AttachToIndex
instance Prelude.NFData AttachToIndex
instance Core.ToHeaders AttachToIndex where
toHeaders :: AttachToIndex -> ResponseHeaders
toHeaders AttachToIndex' {Text
ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
directoryArn :: Text
$sel:targetReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:indexReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:directoryArn:AttachToIndex' :: AttachToIndex -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
directoryArn]
instance Core.ToJSON AttachToIndex where
toJSON :: AttachToIndex -> Value
toJSON AttachToIndex' {Text
ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
directoryArn :: Text
$sel:targetReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:indexReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:directoryArn:AttachToIndex' :: AttachToIndex -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"IndexReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
indexReference),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TargetReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
targetReference)
]
)
instance Core.ToPath AttachToIndex where
toPath :: AttachToIndex -> ByteString
toPath =
ByteString -> AttachToIndex -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/index/attach"
instance Core.ToQuery AttachToIndex where
toQuery :: AttachToIndex -> QueryString
toQuery = QueryString -> AttachToIndex -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AttachToIndexResponse = AttachToIndexResponse'
{
AttachToIndexResponse -> Maybe Text
attachedObjectIdentifier :: Prelude.Maybe Prelude.Text,
AttachToIndexResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AttachToIndexResponse -> AttachToIndexResponse -> Bool
(AttachToIndexResponse -> AttachToIndexResponse -> Bool)
-> (AttachToIndexResponse -> AttachToIndexResponse -> Bool)
-> Eq AttachToIndexResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachToIndexResponse -> AttachToIndexResponse -> Bool
$c/= :: AttachToIndexResponse -> AttachToIndexResponse -> Bool
== :: AttachToIndexResponse -> AttachToIndexResponse -> Bool
$c== :: AttachToIndexResponse -> AttachToIndexResponse -> Bool
Prelude.Eq, ReadPrec [AttachToIndexResponse]
ReadPrec AttachToIndexResponse
Int -> ReadS AttachToIndexResponse
ReadS [AttachToIndexResponse]
(Int -> ReadS AttachToIndexResponse)
-> ReadS [AttachToIndexResponse]
-> ReadPrec AttachToIndexResponse
-> ReadPrec [AttachToIndexResponse]
-> Read AttachToIndexResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachToIndexResponse]
$creadListPrec :: ReadPrec [AttachToIndexResponse]
readPrec :: ReadPrec AttachToIndexResponse
$creadPrec :: ReadPrec AttachToIndexResponse
readList :: ReadS [AttachToIndexResponse]
$creadList :: ReadS [AttachToIndexResponse]
readsPrec :: Int -> ReadS AttachToIndexResponse
$creadsPrec :: Int -> ReadS AttachToIndexResponse
Prelude.Read, Int -> AttachToIndexResponse -> ShowS
[AttachToIndexResponse] -> ShowS
AttachToIndexResponse -> String
(Int -> AttachToIndexResponse -> ShowS)
-> (AttachToIndexResponse -> String)
-> ([AttachToIndexResponse] -> ShowS)
-> Show AttachToIndexResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachToIndexResponse] -> ShowS
$cshowList :: [AttachToIndexResponse] -> ShowS
show :: AttachToIndexResponse -> String
$cshow :: AttachToIndexResponse -> String
showsPrec :: Int -> AttachToIndexResponse -> ShowS
$cshowsPrec :: Int -> AttachToIndexResponse -> ShowS
Prelude.Show, (forall x. AttachToIndexResponse -> Rep AttachToIndexResponse x)
-> (forall x. Rep AttachToIndexResponse x -> AttachToIndexResponse)
-> Generic AttachToIndexResponse
forall x. Rep AttachToIndexResponse x -> AttachToIndexResponse
forall x. AttachToIndexResponse -> Rep AttachToIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachToIndexResponse x -> AttachToIndexResponse
$cfrom :: forall x. AttachToIndexResponse -> Rep AttachToIndexResponse x
Prelude.Generic)
newAttachToIndexResponse ::
Prelude.Int ->
AttachToIndexResponse
newAttachToIndexResponse :: Int -> AttachToIndexResponse
newAttachToIndexResponse Int
pHttpStatus_ =
AttachToIndexResponse' :: Maybe Text -> Int -> AttachToIndexResponse
AttachToIndexResponse'
{ $sel:attachedObjectIdentifier:AttachToIndexResponse' :: Maybe Text
attachedObjectIdentifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AttachToIndexResponse' :: Int
httpStatus = Int
pHttpStatus_
}
attachToIndexResponse_attachedObjectIdentifier :: Lens.Lens' AttachToIndexResponse (Prelude.Maybe Prelude.Text)
attachToIndexResponse_attachedObjectIdentifier :: (Maybe Text -> f (Maybe Text))
-> AttachToIndexResponse -> f AttachToIndexResponse
attachToIndexResponse_attachedObjectIdentifier = (AttachToIndexResponse -> Maybe Text)
-> (AttachToIndexResponse -> Maybe Text -> AttachToIndexResponse)
-> Lens
AttachToIndexResponse
AttachToIndexResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachToIndexResponse' {Maybe Text
attachedObjectIdentifier :: Maybe Text
$sel:attachedObjectIdentifier:AttachToIndexResponse' :: AttachToIndexResponse -> Maybe Text
attachedObjectIdentifier} -> Maybe Text
attachedObjectIdentifier) (\s :: AttachToIndexResponse
s@AttachToIndexResponse' {} Maybe Text
a -> AttachToIndexResponse
s {$sel:attachedObjectIdentifier:AttachToIndexResponse' :: Maybe Text
attachedObjectIdentifier = Maybe Text
a} :: AttachToIndexResponse)
attachToIndexResponse_httpStatus :: Lens.Lens' AttachToIndexResponse Prelude.Int
attachToIndexResponse_httpStatus :: (Int -> f Int) -> AttachToIndexResponse -> f AttachToIndexResponse
attachToIndexResponse_httpStatus = (AttachToIndexResponse -> Int)
-> (AttachToIndexResponse -> Int -> AttachToIndexResponse)
-> Lens AttachToIndexResponse AttachToIndexResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachToIndexResponse' {Int
httpStatus :: Int
$sel:httpStatus:AttachToIndexResponse' :: AttachToIndexResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AttachToIndexResponse
s@AttachToIndexResponse' {} Int
a -> AttachToIndexResponse
s {$sel:httpStatus:AttachToIndexResponse' :: Int
httpStatus = Int
a} :: AttachToIndexResponse)
instance Prelude.NFData AttachToIndexResponse