{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $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 :: Lens' AttachToIndex Text
attachToIndex_directoryArn = 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 :: Lens' AttachToIndex ObjectReference
attachToIndex_indexReference = 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 :: Lens' AttachToIndex ObjectReference
attachToIndex_targetReference = 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 :: (Service -> Service) -> AttachToIndex -> Request AttachToIndex
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AttachToIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachToIndex)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> AttachToIndexResponse
AttachToIndexResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AttachedObjectIdentifier")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AttachToIndex where
hashWithSalt :: Int -> AttachToIndex -> Int
hashWithSalt Int
_salt AttachToIndex' {Text
ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
directoryArn :: Text
$sel:targetReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:indexReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:directoryArn:AttachToIndex' :: AttachToIndex -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
indexReference
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
targetReference
instance Prelude.NFData AttachToIndex where
rnf :: AttachToIndex -> ()
rnf AttachToIndex' {Text
ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
directoryArn :: Text
$sel:targetReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:indexReference:AttachToIndex' :: AttachToIndex -> ObjectReference
$sel:directoryArn:AttachToIndex' :: AttachToIndex -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
directoryArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
indexReference
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
targetReference
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
directoryArn]
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"IndexReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
indexReference),
forall a. a -> Maybe a
Prelude.Just
(Key
"TargetReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
targetReference)
]
)
instance Data.ToPath AttachToIndex where
toPath :: AttachToIndex -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/index/attach"
instance Data.ToQuery AttachToIndex where
toQuery :: AttachToIndex -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:attachedObjectIdentifier:AttachToIndexResponse' :: Maybe Text
attachedObjectIdentifier =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AttachToIndexResponse' :: Int
httpStatus = Int
pHttpStatus_
}
attachToIndexResponse_attachedObjectIdentifier :: Lens.Lens' AttachToIndexResponse (Prelude.Maybe Prelude.Text)
attachToIndexResponse_attachedObjectIdentifier :: Lens' AttachToIndexResponse (Maybe Text)
attachToIndexResponse_attachedObjectIdentifier = 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 :: Lens' AttachToIndexResponse Int
attachToIndexResponse_httpStatus = 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 where
rnf :: AttachToIndexResponse -> ()
rnf AttachToIndexResponse' {Int
Maybe Text
httpStatus :: Int
attachedObjectIdentifier :: Maybe Text
$sel:httpStatus:AttachToIndexResponse' :: AttachToIndexResponse -> Int
$sel:attachedObjectIdentifier:AttachToIndexResponse' :: AttachToIndexResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attachedObjectIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus