{-# 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.AttachObject
(
AttachObject (..),
newAttachObject,
attachObject_directoryArn,
attachObject_parentReference,
attachObject_childReference,
attachObject_linkName,
AttachObjectResponse (..),
newAttachObjectResponse,
attachObjectResponse_attachedObjectIdentifier,
attachObjectResponse_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 AttachObject = AttachObject'
{
AttachObject -> Text
directoryArn :: Prelude.Text,
AttachObject -> ObjectReference
parentReference :: ObjectReference,
AttachObject -> ObjectReference
childReference :: ObjectReference,
AttachObject -> Text
linkName :: Prelude.Text
}
deriving (AttachObject -> AttachObject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachObject -> AttachObject -> Bool
$c/= :: AttachObject -> AttachObject -> Bool
== :: AttachObject -> AttachObject -> Bool
$c== :: AttachObject -> AttachObject -> Bool
Prelude.Eq, ReadPrec [AttachObject]
ReadPrec AttachObject
Int -> ReadS AttachObject
ReadS [AttachObject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachObject]
$creadListPrec :: ReadPrec [AttachObject]
readPrec :: ReadPrec AttachObject
$creadPrec :: ReadPrec AttachObject
readList :: ReadS [AttachObject]
$creadList :: ReadS [AttachObject]
readsPrec :: Int -> ReadS AttachObject
$creadsPrec :: Int -> ReadS AttachObject
Prelude.Read, Int -> AttachObject -> ShowS
[AttachObject] -> ShowS
AttachObject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachObject] -> ShowS
$cshowList :: [AttachObject] -> ShowS
show :: AttachObject -> String
$cshow :: AttachObject -> String
showsPrec :: Int -> AttachObject -> ShowS
$cshowsPrec :: Int -> AttachObject -> ShowS
Prelude.Show, forall x. Rep AttachObject x -> AttachObject
forall x. AttachObject -> Rep AttachObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachObject x -> AttachObject
$cfrom :: forall x. AttachObject -> Rep AttachObject x
Prelude.Generic)
newAttachObject ::
Prelude.Text ->
ObjectReference ->
ObjectReference ->
Prelude.Text ->
AttachObject
newAttachObject :: Text -> ObjectReference -> ObjectReference -> Text -> AttachObject
newAttachObject
Text
pDirectoryArn_
ObjectReference
pParentReference_
ObjectReference
pChildReference_
Text
pLinkName_ =
AttachObject'
{ $sel:directoryArn:AttachObject' :: Text
directoryArn = Text
pDirectoryArn_,
$sel:parentReference:AttachObject' :: ObjectReference
parentReference = ObjectReference
pParentReference_,
$sel:childReference:AttachObject' :: ObjectReference
childReference = ObjectReference
pChildReference_,
$sel:linkName:AttachObject' :: Text
linkName = Text
pLinkName_
}
attachObject_directoryArn :: Lens.Lens' AttachObject Prelude.Text
attachObject_directoryArn :: Lens' AttachObject Text
attachObject_directoryArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachObject' {Text
directoryArn :: Text
$sel:directoryArn:AttachObject' :: AttachObject -> Text
directoryArn} -> Text
directoryArn) (\s :: AttachObject
s@AttachObject' {} Text
a -> AttachObject
s {$sel:directoryArn:AttachObject' :: Text
directoryArn = Text
a} :: AttachObject)
attachObject_parentReference :: Lens.Lens' AttachObject ObjectReference
attachObject_parentReference :: Lens' AttachObject ObjectReference
attachObject_parentReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachObject' {ObjectReference
parentReference :: ObjectReference
$sel:parentReference:AttachObject' :: AttachObject -> ObjectReference
parentReference} -> ObjectReference
parentReference) (\s :: AttachObject
s@AttachObject' {} ObjectReference
a -> AttachObject
s {$sel:parentReference:AttachObject' :: ObjectReference
parentReference = ObjectReference
a} :: AttachObject)
attachObject_childReference :: Lens.Lens' AttachObject ObjectReference
attachObject_childReference :: Lens' AttachObject ObjectReference
attachObject_childReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachObject' {ObjectReference
childReference :: ObjectReference
$sel:childReference:AttachObject' :: AttachObject -> ObjectReference
childReference} -> ObjectReference
childReference) (\s :: AttachObject
s@AttachObject' {} ObjectReference
a -> AttachObject
s {$sel:childReference:AttachObject' :: ObjectReference
childReference = ObjectReference
a} :: AttachObject)
attachObject_linkName :: Lens.Lens' AttachObject Prelude.Text
attachObject_linkName :: Lens' AttachObject Text
attachObject_linkName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachObject' {Text
linkName :: Text
$sel:linkName:AttachObject' :: AttachObject -> Text
linkName} -> Text
linkName) (\s :: AttachObject
s@AttachObject' {} Text
a -> AttachObject
s {$sel:linkName:AttachObject' :: Text
linkName = Text
a} :: AttachObject)
instance Core.AWSRequest AttachObject where
type AWSResponse AttachObject = AttachObjectResponse
request :: (Service -> Service) -> AttachObject -> Request AttachObject
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 AttachObject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachObject)))
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 -> AttachObjectResponse
AttachObjectResponse'
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 AttachObject where
hashWithSalt :: Int -> AttachObject -> Int
hashWithSalt Int
_salt AttachObject' {Text
ObjectReference
linkName :: Text
childReference :: ObjectReference
parentReference :: ObjectReference
directoryArn :: Text
$sel:linkName:AttachObject' :: AttachObject -> Text
$sel:childReference:AttachObject' :: AttachObject -> ObjectReference
$sel:parentReference:AttachObject' :: AttachObject -> ObjectReference
$sel:directoryArn:AttachObject' :: AttachObject -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
parentReference
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ObjectReference
childReference
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
linkName
instance Prelude.NFData AttachObject where
rnf :: AttachObject -> ()
rnf AttachObject' {Text
ObjectReference
linkName :: Text
childReference :: ObjectReference
parentReference :: ObjectReference
directoryArn :: Text
$sel:linkName:AttachObject' :: AttachObject -> Text
$sel:childReference:AttachObject' :: AttachObject -> ObjectReference
$sel:parentReference:AttachObject' :: AttachObject -> ObjectReference
$sel:directoryArn:AttachObject' :: AttachObject -> 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
parentReference
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ObjectReference
childReference
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
linkName
instance Data.ToHeaders AttachObject where
toHeaders :: AttachObject -> ResponseHeaders
toHeaders AttachObject' {Text
ObjectReference
linkName :: Text
childReference :: ObjectReference
parentReference :: ObjectReference
directoryArn :: Text
$sel:linkName:AttachObject' :: AttachObject -> Text
$sel:childReference:AttachObject' :: AttachObject -> ObjectReference
$sel:parentReference:AttachObject' :: AttachObject -> ObjectReference
$sel:directoryArn:AttachObject' :: AttachObject -> 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 AttachObject where
toJSON :: AttachObject -> Value
toJSON AttachObject' {Text
ObjectReference
linkName :: Text
childReference :: ObjectReference
parentReference :: ObjectReference
directoryArn :: Text
$sel:linkName:AttachObject' :: AttachObject -> Text
$sel:childReference:AttachObject' :: AttachObject -> ObjectReference
$sel:parentReference:AttachObject' :: AttachObject -> ObjectReference
$sel:directoryArn:AttachObject' :: AttachObject -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"ParentReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
parentReference),
forall a. a -> Maybe a
Prelude.Just
(Key
"ChildReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ObjectReference
childReference),
forall a. a -> Maybe a
Prelude.Just (Key
"LinkName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
linkName)
]
)
instance Data.ToPath AttachObject where
toPath :: AttachObject -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/object/attach"
instance Data.ToQuery AttachObject where
toQuery :: AttachObject -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AttachObjectResponse = AttachObjectResponse'
{
AttachObjectResponse -> Maybe Text
attachedObjectIdentifier :: Prelude.Maybe Prelude.Text,
AttachObjectResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AttachObjectResponse -> AttachObjectResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachObjectResponse -> AttachObjectResponse -> Bool
$c/= :: AttachObjectResponse -> AttachObjectResponse -> Bool
== :: AttachObjectResponse -> AttachObjectResponse -> Bool
$c== :: AttachObjectResponse -> AttachObjectResponse -> Bool
Prelude.Eq, ReadPrec [AttachObjectResponse]
ReadPrec AttachObjectResponse
Int -> ReadS AttachObjectResponse
ReadS [AttachObjectResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachObjectResponse]
$creadListPrec :: ReadPrec [AttachObjectResponse]
readPrec :: ReadPrec AttachObjectResponse
$creadPrec :: ReadPrec AttachObjectResponse
readList :: ReadS [AttachObjectResponse]
$creadList :: ReadS [AttachObjectResponse]
readsPrec :: Int -> ReadS AttachObjectResponse
$creadsPrec :: Int -> ReadS AttachObjectResponse
Prelude.Read, Int -> AttachObjectResponse -> ShowS
[AttachObjectResponse] -> ShowS
AttachObjectResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachObjectResponse] -> ShowS
$cshowList :: [AttachObjectResponse] -> ShowS
show :: AttachObjectResponse -> String
$cshow :: AttachObjectResponse -> String
showsPrec :: Int -> AttachObjectResponse -> ShowS
$cshowsPrec :: Int -> AttachObjectResponse -> ShowS
Prelude.Show, forall x. Rep AttachObjectResponse x -> AttachObjectResponse
forall x. AttachObjectResponse -> Rep AttachObjectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachObjectResponse x -> AttachObjectResponse
$cfrom :: forall x. AttachObjectResponse -> Rep AttachObjectResponse x
Prelude.Generic)
newAttachObjectResponse ::
Prelude.Int ->
AttachObjectResponse
newAttachObjectResponse :: Int -> AttachObjectResponse
newAttachObjectResponse Int
pHttpStatus_ =
AttachObjectResponse'
{ $sel:attachedObjectIdentifier:AttachObjectResponse' :: Maybe Text
attachedObjectIdentifier =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AttachObjectResponse' :: Int
httpStatus = Int
pHttpStatus_
}
attachObjectResponse_attachedObjectIdentifier :: Lens.Lens' AttachObjectResponse (Prelude.Maybe Prelude.Text)
attachObjectResponse_attachedObjectIdentifier :: Lens' AttachObjectResponse (Maybe Text)
attachObjectResponse_attachedObjectIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachObjectResponse' {Maybe Text
attachedObjectIdentifier :: Maybe Text
$sel:attachedObjectIdentifier:AttachObjectResponse' :: AttachObjectResponse -> Maybe Text
attachedObjectIdentifier} -> Maybe Text
attachedObjectIdentifier) (\s :: AttachObjectResponse
s@AttachObjectResponse' {} Maybe Text
a -> AttachObjectResponse
s {$sel:attachedObjectIdentifier:AttachObjectResponse' :: Maybe Text
attachedObjectIdentifier = Maybe Text
a} :: AttachObjectResponse)
attachObjectResponse_httpStatus :: Lens.Lens' AttachObjectResponse Prelude.Int
attachObjectResponse_httpStatus :: Lens' AttachObjectResponse Int
attachObjectResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachObjectResponse' {Int
httpStatus :: Int
$sel:httpStatus:AttachObjectResponse' :: AttachObjectResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AttachObjectResponse
s@AttachObjectResponse' {} Int
a -> AttachObjectResponse
s {$sel:httpStatus:AttachObjectResponse' :: Int
httpStatus = Int
a} :: AttachObjectResponse)
instance Prelude.NFData AttachObjectResponse where
rnf :: AttachObjectResponse -> ()
rnf AttachObjectResponse' {Int
Maybe Text
httpStatus :: Int
attachedObjectIdentifier :: Maybe Text
$sel:httpStatus:AttachObjectResponse' :: AttachObjectResponse -> Int
$sel:attachedObjectIdentifier:AttachObjectResponse' :: AttachObjectResponse -> 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