{-# 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.GetObjectInformation
(
getObjectInformation
, GetObjectInformation
, goiConsistencyLevel
, goiDirectoryARN
, goiObjectReference
, getObjectInformationResponse
, GetObjectInformationResponse
, goirsObjectIdentifier
, goirsSchemaFacets
, goirsResponseStatus
) 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 GetObjectInformation = GetObjectInformation'
{ _goiConsistencyLevel :: !(Maybe ConsistencyLevel)
, _goiDirectoryARN :: !Text
, _goiObjectReference :: !ObjectReference
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getObjectInformation
:: Text
-> ObjectReference
-> GetObjectInformation
getObjectInformation pDirectoryARN_ pObjectReference_ =
GetObjectInformation'
{ _goiConsistencyLevel = Nothing
, _goiDirectoryARN = pDirectoryARN_
, _goiObjectReference = pObjectReference_
}
goiConsistencyLevel :: Lens' GetObjectInformation (Maybe ConsistencyLevel)
goiConsistencyLevel = lens _goiConsistencyLevel (\ s a -> s{_goiConsistencyLevel = a})
goiDirectoryARN :: Lens' GetObjectInformation Text
goiDirectoryARN = lens _goiDirectoryARN (\ s a -> s{_goiDirectoryARN = a})
goiObjectReference :: Lens' GetObjectInformation ObjectReference
goiObjectReference = lens _goiObjectReference (\ s a -> s{_goiObjectReference = a})
instance AWSRequest GetObjectInformation where
type Rs GetObjectInformation =
GetObjectInformationResponse
request = postJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
GetObjectInformationResponse' <$>
(x .?> "ObjectIdentifier") <*>
(x .?> "SchemaFacets" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable GetObjectInformation where
instance NFData GetObjectInformation where
instance ToHeaders GetObjectInformation where
toHeaders GetObjectInformation'{..}
= mconcat
["x-amz-consistency-level" =# _goiConsistencyLevel,
"x-amz-data-partition" =# _goiDirectoryARN]
instance ToJSON GetObjectInformation where
toJSON GetObjectInformation'{..}
= object
(catMaybes
[Just ("ObjectReference" .= _goiObjectReference)])
instance ToPath GetObjectInformation where
toPath
= const
"/amazonclouddirectory/2017-01-11/object/information"
instance ToQuery GetObjectInformation where
toQuery = const mempty
data GetObjectInformationResponse = GetObjectInformationResponse'
{ _goirsObjectIdentifier :: !(Maybe Text)
, _goirsSchemaFacets :: !(Maybe [SchemaFacet])
, _goirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getObjectInformationResponse
:: Int
-> GetObjectInformationResponse
getObjectInformationResponse pResponseStatus_ =
GetObjectInformationResponse'
{ _goirsObjectIdentifier = Nothing
, _goirsSchemaFacets = Nothing
, _goirsResponseStatus = pResponseStatus_
}
goirsObjectIdentifier :: Lens' GetObjectInformationResponse (Maybe Text)
goirsObjectIdentifier = lens _goirsObjectIdentifier (\ s a -> s{_goirsObjectIdentifier = a})
goirsSchemaFacets :: Lens' GetObjectInformationResponse [SchemaFacet]
goirsSchemaFacets = lens _goirsSchemaFacets (\ s a -> s{_goirsSchemaFacets = a}) . _Default . _Coerce
goirsResponseStatus :: Lens' GetObjectInformationResponse Int
goirsResponseStatus = lens _goirsResponseStatus (\ s a -> s{_goirsResponseStatus = a})
instance NFData GetObjectInformationResponse where