{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CloudDirectory.GetObjectAttributes
(
getObjectAttributes
, GetObjectAttributes
, goaConsistencyLevel
, goaDirectoryARN
, goaObjectReference
, goaSchemaFacet
, goaAttributeNames
, getObjectAttributesResponse
, GetObjectAttributesResponse
, goarsAttributes
, goarsResponseStatus
) where
import Network.AWS.CloudDirectory.Types
import Network.AWS.CloudDirectory.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetObjectAttributes = GetObjectAttributes'
{ _goaConsistencyLevel :: !(Maybe ConsistencyLevel)
, _goaDirectoryARN :: !Text
, _goaObjectReference :: !ObjectReference
, _goaSchemaFacet :: !SchemaFacet
, _goaAttributeNames :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getObjectAttributes
:: Text
-> ObjectReference
-> SchemaFacet
-> GetObjectAttributes
getObjectAttributes pDirectoryARN_ pObjectReference_ pSchemaFacet_ =
GetObjectAttributes'
{ _goaConsistencyLevel = Nothing
, _goaDirectoryARN = pDirectoryARN_
, _goaObjectReference = pObjectReference_
, _goaSchemaFacet = pSchemaFacet_
, _goaAttributeNames = mempty
}
goaConsistencyLevel :: Lens' GetObjectAttributes (Maybe ConsistencyLevel)
goaConsistencyLevel = lens _goaConsistencyLevel (\ s a -> s{_goaConsistencyLevel = a})
goaDirectoryARN :: Lens' GetObjectAttributes Text
goaDirectoryARN = lens _goaDirectoryARN (\ s a -> s{_goaDirectoryARN = a})
goaObjectReference :: Lens' GetObjectAttributes ObjectReference
goaObjectReference = lens _goaObjectReference (\ s a -> s{_goaObjectReference = a})
goaSchemaFacet :: Lens' GetObjectAttributes SchemaFacet
goaSchemaFacet = lens _goaSchemaFacet (\ s a -> s{_goaSchemaFacet = a})
goaAttributeNames :: Lens' GetObjectAttributes [Text]
goaAttributeNames = lens _goaAttributeNames (\ s a -> s{_goaAttributeNames = a}) . _Coerce
instance AWSRequest GetObjectAttributes where
type Rs GetObjectAttributes =
GetObjectAttributesResponse
request = postJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
GetObjectAttributesResponse' <$>
(x .?> "Attributes" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable GetObjectAttributes where
instance NFData GetObjectAttributes where
instance ToHeaders GetObjectAttributes where
toHeaders GetObjectAttributes'{..}
= mconcat
["x-amz-consistency-level" =# _goaConsistencyLevel,
"x-amz-data-partition" =# _goaDirectoryARN]
instance ToJSON GetObjectAttributes where
toJSON GetObjectAttributes'{..}
= object
(catMaybes
[Just ("ObjectReference" .= _goaObjectReference),
Just ("SchemaFacet" .= _goaSchemaFacet),
Just ("AttributeNames" .= _goaAttributeNames)])
instance ToPath GetObjectAttributes where
toPath
= const
"/amazonclouddirectory/2017-01-11/object/attributes/get"
instance ToQuery GetObjectAttributes where
toQuery = const mempty
data GetObjectAttributesResponse = GetObjectAttributesResponse'
{ _goarsAttributes :: !(Maybe [AttributeKeyAndValue])
, _goarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getObjectAttributesResponse
:: Int
-> GetObjectAttributesResponse
getObjectAttributesResponse pResponseStatus_ =
GetObjectAttributesResponse'
{_goarsAttributes = Nothing, _goarsResponseStatus = pResponseStatus_}
goarsAttributes :: Lens' GetObjectAttributesResponse [AttributeKeyAndValue]
goarsAttributes = lens _goarsAttributes (\ s a -> s{_goarsAttributes = a}) . _Default . _Coerce
goarsResponseStatus :: Lens' GetObjectAttributesResponse Int
goarsResponseStatus = lens _goarsResponseStatus (\ s a -> s{_goarsResponseStatus = a})
instance NFData GetObjectAttributesResponse where