{-# 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.DetachFromIndex
(
DetachFromIndex (..),
newDetachFromIndex,
detachFromIndex_directoryArn,
detachFromIndex_indexReference,
detachFromIndex_targetReference,
DetachFromIndexResponse (..),
newDetachFromIndexResponse,
detachFromIndexResponse_detachedObjectIdentifier,
detachFromIndexResponse_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 DetachFromIndex = DetachFromIndex'
{
DetachFromIndex -> Text
directoryArn :: Prelude.Text,
DetachFromIndex -> ObjectReference
indexReference :: ObjectReference,
DetachFromIndex -> ObjectReference
targetReference :: ObjectReference
}
deriving (DetachFromIndex -> DetachFromIndex -> Bool
(DetachFromIndex -> DetachFromIndex -> Bool)
-> (DetachFromIndex -> DetachFromIndex -> Bool)
-> Eq DetachFromIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachFromIndex -> DetachFromIndex -> Bool
$c/= :: DetachFromIndex -> DetachFromIndex -> Bool
== :: DetachFromIndex -> DetachFromIndex -> Bool
$c== :: DetachFromIndex -> DetachFromIndex -> Bool
Prelude.Eq, ReadPrec [DetachFromIndex]
ReadPrec DetachFromIndex
Int -> ReadS DetachFromIndex
ReadS [DetachFromIndex]
(Int -> ReadS DetachFromIndex)
-> ReadS [DetachFromIndex]
-> ReadPrec DetachFromIndex
-> ReadPrec [DetachFromIndex]
-> Read DetachFromIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachFromIndex]
$creadListPrec :: ReadPrec [DetachFromIndex]
readPrec :: ReadPrec DetachFromIndex
$creadPrec :: ReadPrec DetachFromIndex
readList :: ReadS [DetachFromIndex]
$creadList :: ReadS [DetachFromIndex]
readsPrec :: Int -> ReadS DetachFromIndex
$creadsPrec :: Int -> ReadS DetachFromIndex
Prelude.Read, Int -> DetachFromIndex -> ShowS
[DetachFromIndex] -> ShowS
DetachFromIndex -> String
(Int -> DetachFromIndex -> ShowS)
-> (DetachFromIndex -> String)
-> ([DetachFromIndex] -> ShowS)
-> Show DetachFromIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachFromIndex] -> ShowS
$cshowList :: [DetachFromIndex] -> ShowS
show :: DetachFromIndex -> String
$cshow :: DetachFromIndex -> String
showsPrec :: Int -> DetachFromIndex -> ShowS
$cshowsPrec :: Int -> DetachFromIndex -> ShowS
Prelude.Show, (forall x. DetachFromIndex -> Rep DetachFromIndex x)
-> (forall x. Rep DetachFromIndex x -> DetachFromIndex)
-> Generic DetachFromIndex
forall x. Rep DetachFromIndex x -> DetachFromIndex
forall x. DetachFromIndex -> Rep DetachFromIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetachFromIndex x -> DetachFromIndex
$cfrom :: forall x. DetachFromIndex -> Rep DetachFromIndex x
Prelude.Generic)
newDetachFromIndex ::
Prelude.Text ->
ObjectReference ->
ObjectReference ->
DetachFromIndex
newDetachFromIndex :: Text -> ObjectReference -> ObjectReference -> DetachFromIndex
newDetachFromIndex
Text
pDirectoryArn_
ObjectReference
pIndexReference_
ObjectReference
pTargetReference_ =
DetachFromIndex' :: Text -> ObjectReference -> ObjectReference -> DetachFromIndex
DetachFromIndex'
{ $sel:directoryArn:DetachFromIndex' :: Text
directoryArn = Text
pDirectoryArn_,
$sel:indexReference:DetachFromIndex' :: ObjectReference
indexReference = ObjectReference
pIndexReference_,
$sel:targetReference:DetachFromIndex' :: ObjectReference
targetReference = ObjectReference
pTargetReference_
}
detachFromIndex_directoryArn :: Lens.Lens' DetachFromIndex Prelude.Text
detachFromIndex_directoryArn :: (Text -> f Text) -> DetachFromIndex -> f DetachFromIndex
detachFromIndex_directoryArn = (DetachFromIndex -> Text)
-> (DetachFromIndex -> Text -> DetachFromIndex)
-> Lens DetachFromIndex DetachFromIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachFromIndex' {Text
directoryArn :: Text
$sel:directoryArn:DetachFromIndex' :: DetachFromIndex -> Text
directoryArn} -> Text
directoryArn) (\s :: DetachFromIndex
s@DetachFromIndex' {} Text
a -> DetachFromIndex
s {$sel:directoryArn:DetachFromIndex' :: Text
directoryArn = Text
a} :: DetachFromIndex)
detachFromIndex_indexReference :: Lens.Lens' DetachFromIndex ObjectReference
detachFromIndex_indexReference :: (ObjectReference -> f ObjectReference)
-> DetachFromIndex -> f DetachFromIndex
detachFromIndex_indexReference = (DetachFromIndex -> ObjectReference)
-> (DetachFromIndex -> ObjectReference -> DetachFromIndex)
-> Lens
DetachFromIndex DetachFromIndex ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachFromIndex' {ObjectReference
indexReference :: ObjectReference
$sel:indexReference:DetachFromIndex' :: DetachFromIndex -> ObjectReference
indexReference} -> ObjectReference
indexReference) (\s :: DetachFromIndex
s@DetachFromIndex' {} ObjectReference
a -> DetachFromIndex
s {$sel:indexReference:DetachFromIndex' :: ObjectReference
indexReference = ObjectReference
a} :: DetachFromIndex)
detachFromIndex_targetReference :: Lens.Lens' DetachFromIndex ObjectReference
detachFromIndex_targetReference :: (ObjectReference -> f ObjectReference)
-> DetachFromIndex -> f DetachFromIndex
detachFromIndex_targetReference = (DetachFromIndex -> ObjectReference)
-> (DetachFromIndex -> ObjectReference -> DetachFromIndex)
-> Lens
DetachFromIndex DetachFromIndex ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachFromIndex' {ObjectReference
targetReference :: ObjectReference
$sel:targetReference:DetachFromIndex' :: DetachFromIndex -> ObjectReference
targetReference} -> ObjectReference
targetReference) (\s :: DetachFromIndex
s@DetachFromIndex' {} ObjectReference
a -> DetachFromIndex
s {$sel:targetReference:DetachFromIndex' :: ObjectReference
targetReference = ObjectReference
a} :: DetachFromIndex)
instance Core.AWSRequest DetachFromIndex where
type
AWSResponse DetachFromIndex =
DetachFromIndexResponse
request :: DetachFromIndex -> Request DetachFromIndex
request = Service -> DetachFromIndex -> Request DetachFromIndex
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DetachFromIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetachFromIndex)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DetachFromIndex))
-> Logger
-> Service
-> Proxy DetachFromIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetachFromIndex)))
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 -> DetachFromIndexResponse
DetachFromIndexResponse'
(Maybe Text -> Int -> DetachFromIndexResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DetachFromIndexResponse)
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
"DetachedObjectIdentifier")
Either String (Int -> DetachFromIndexResponse)
-> Either String Int -> Either String DetachFromIndexResponse
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 DetachFromIndex
instance Prelude.NFData DetachFromIndex
instance Core.ToHeaders DetachFromIndex where
toHeaders :: DetachFromIndex -> ResponseHeaders
toHeaders DetachFromIndex' {Text
ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
directoryArn :: Text
$sel:targetReference:DetachFromIndex' :: DetachFromIndex -> ObjectReference
$sel:indexReference:DetachFromIndex' :: DetachFromIndex -> ObjectReference
$sel:directoryArn:DetachFromIndex' :: DetachFromIndex -> 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 DetachFromIndex where
toJSON :: DetachFromIndex -> Value
toJSON DetachFromIndex' {Text
ObjectReference
targetReference :: ObjectReference
indexReference :: ObjectReference
directoryArn :: Text
$sel:targetReference:DetachFromIndex' :: DetachFromIndex -> ObjectReference
$sel:indexReference:DetachFromIndex' :: DetachFromIndex -> ObjectReference
$sel:directoryArn:DetachFromIndex' :: DetachFromIndex -> 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 DetachFromIndex where
toPath :: DetachFromIndex -> ByteString
toPath =
ByteString -> DetachFromIndex -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/index/detach"
instance Core.ToQuery DetachFromIndex where
toQuery :: DetachFromIndex -> QueryString
toQuery = QueryString -> DetachFromIndex -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DetachFromIndexResponse = DetachFromIndexResponse'
{
DetachFromIndexResponse -> Maybe Text
detachedObjectIdentifier :: Prelude.Maybe Prelude.Text,
DetachFromIndexResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetachFromIndexResponse -> DetachFromIndexResponse -> Bool
(DetachFromIndexResponse -> DetachFromIndexResponse -> Bool)
-> (DetachFromIndexResponse -> DetachFromIndexResponse -> Bool)
-> Eq DetachFromIndexResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachFromIndexResponse -> DetachFromIndexResponse -> Bool
$c/= :: DetachFromIndexResponse -> DetachFromIndexResponse -> Bool
== :: DetachFromIndexResponse -> DetachFromIndexResponse -> Bool
$c== :: DetachFromIndexResponse -> DetachFromIndexResponse -> Bool
Prelude.Eq, ReadPrec [DetachFromIndexResponse]
ReadPrec DetachFromIndexResponse
Int -> ReadS DetachFromIndexResponse
ReadS [DetachFromIndexResponse]
(Int -> ReadS DetachFromIndexResponse)
-> ReadS [DetachFromIndexResponse]
-> ReadPrec DetachFromIndexResponse
-> ReadPrec [DetachFromIndexResponse]
-> Read DetachFromIndexResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachFromIndexResponse]
$creadListPrec :: ReadPrec [DetachFromIndexResponse]
readPrec :: ReadPrec DetachFromIndexResponse
$creadPrec :: ReadPrec DetachFromIndexResponse
readList :: ReadS [DetachFromIndexResponse]
$creadList :: ReadS [DetachFromIndexResponse]
readsPrec :: Int -> ReadS DetachFromIndexResponse
$creadsPrec :: Int -> ReadS DetachFromIndexResponse
Prelude.Read, Int -> DetachFromIndexResponse -> ShowS
[DetachFromIndexResponse] -> ShowS
DetachFromIndexResponse -> String
(Int -> DetachFromIndexResponse -> ShowS)
-> (DetachFromIndexResponse -> String)
-> ([DetachFromIndexResponse] -> ShowS)
-> Show DetachFromIndexResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachFromIndexResponse] -> ShowS
$cshowList :: [DetachFromIndexResponse] -> ShowS
show :: DetachFromIndexResponse -> String
$cshow :: DetachFromIndexResponse -> String
showsPrec :: Int -> DetachFromIndexResponse -> ShowS
$cshowsPrec :: Int -> DetachFromIndexResponse -> ShowS
Prelude.Show, (forall x.
DetachFromIndexResponse -> Rep DetachFromIndexResponse x)
-> (forall x.
Rep DetachFromIndexResponse x -> DetachFromIndexResponse)
-> Generic DetachFromIndexResponse
forall x. Rep DetachFromIndexResponse x -> DetachFromIndexResponse
forall x. DetachFromIndexResponse -> Rep DetachFromIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetachFromIndexResponse x -> DetachFromIndexResponse
$cfrom :: forall x. DetachFromIndexResponse -> Rep DetachFromIndexResponse x
Prelude.Generic)
newDetachFromIndexResponse ::
Prelude.Int ->
DetachFromIndexResponse
newDetachFromIndexResponse :: Int -> DetachFromIndexResponse
newDetachFromIndexResponse Int
pHttpStatus_ =
DetachFromIndexResponse' :: Maybe Text -> Int -> DetachFromIndexResponse
DetachFromIndexResponse'
{ $sel:detachedObjectIdentifier:DetachFromIndexResponse' :: Maybe Text
detachedObjectIdentifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetachFromIndexResponse' :: Int
httpStatus = Int
pHttpStatus_
}
detachFromIndexResponse_detachedObjectIdentifier :: Lens.Lens' DetachFromIndexResponse (Prelude.Maybe Prelude.Text)
detachFromIndexResponse_detachedObjectIdentifier :: (Maybe Text -> f (Maybe Text))
-> DetachFromIndexResponse -> f DetachFromIndexResponse
detachFromIndexResponse_detachedObjectIdentifier = (DetachFromIndexResponse -> Maybe Text)
-> (DetachFromIndexResponse
-> Maybe Text -> DetachFromIndexResponse)
-> Lens
DetachFromIndexResponse
DetachFromIndexResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachFromIndexResponse' {Maybe Text
detachedObjectIdentifier :: Maybe Text
$sel:detachedObjectIdentifier:DetachFromIndexResponse' :: DetachFromIndexResponse -> Maybe Text
detachedObjectIdentifier} -> Maybe Text
detachedObjectIdentifier) (\s :: DetachFromIndexResponse
s@DetachFromIndexResponse' {} Maybe Text
a -> DetachFromIndexResponse
s {$sel:detachedObjectIdentifier:DetachFromIndexResponse' :: Maybe Text
detachedObjectIdentifier = Maybe Text
a} :: DetachFromIndexResponse)
detachFromIndexResponse_httpStatus :: Lens.Lens' DetachFromIndexResponse Prelude.Int
detachFromIndexResponse_httpStatus :: (Int -> f Int)
-> DetachFromIndexResponse -> f DetachFromIndexResponse
detachFromIndexResponse_httpStatus = (DetachFromIndexResponse -> Int)
-> (DetachFromIndexResponse -> Int -> DetachFromIndexResponse)
-> Lens DetachFromIndexResponse DetachFromIndexResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachFromIndexResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetachFromIndexResponse' :: DetachFromIndexResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetachFromIndexResponse
s@DetachFromIndexResponse' {} Int
a -> DetachFromIndexResponse
s {$sel:httpStatus:DetachFromIndexResponse' :: Int
httpStatus = Int
a} :: DetachFromIndexResponse)
instance Prelude.NFData DetachFromIndexResponse