{-# 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.ApplySchema
(
applySchema
, ApplySchema
, asPublishedSchemaARN
, asDirectoryARN
, applySchemaResponse
, ApplySchemaResponse
, asrsDirectoryARN
, asrsAppliedSchemaARN
, asrsResponseStatus
) 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 ApplySchema = ApplySchema'
{ _asPublishedSchemaARN :: !Text
, _asDirectoryARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
applySchema
:: Text
-> Text
-> ApplySchema
applySchema pPublishedSchemaARN_ pDirectoryARN_ =
ApplySchema'
{ _asPublishedSchemaARN = pPublishedSchemaARN_
, _asDirectoryARN = pDirectoryARN_
}
asPublishedSchemaARN :: Lens' ApplySchema Text
asPublishedSchemaARN = lens _asPublishedSchemaARN (\ s a -> s{_asPublishedSchemaARN = a})
asDirectoryARN :: Lens' ApplySchema Text
asDirectoryARN = lens _asDirectoryARN (\ s a -> s{_asDirectoryARN = a})
instance AWSRequest ApplySchema where
type Rs ApplySchema = ApplySchemaResponse
request = putJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
ApplySchemaResponse' <$>
(x .?> "DirectoryArn") <*> (x .?> "AppliedSchemaArn")
<*> (pure (fromEnum s)))
instance Hashable ApplySchema where
instance NFData ApplySchema where
instance ToHeaders ApplySchema where
toHeaders ApplySchema'{..}
= mconcat ["x-amz-data-partition" =# _asDirectoryARN]
instance ToJSON ApplySchema where
toJSON ApplySchema'{..}
= object
(catMaybes
[Just
("PublishedSchemaArn" .= _asPublishedSchemaARN)])
instance ToPath ApplySchema where
toPath
= const
"/amazonclouddirectory/2017-01-11/schema/apply"
instance ToQuery ApplySchema where
toQuery = const mempty
data ApplySchemaResponse = ApplySchemaResponse'
{ _asrsDirectoryARN :: !(Maybe Text)
, _asrsAppliedSchemaARN :: !(Maybe Text)
, _asrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
applySchemaResponse
:: Int
-> ApplySchemaResponse
applySchemaResponse pResponseStatus_ =
ApplySchemaResponse'
{ _asrsDirectoryARN = Nothing
, _asrsAppliedSchemaARN = Nothing
, _asrsResponseStatus = pResponseStatus_
}
asrsDirectoryARN :: Lens' ApplySchemaResponse (Maybe Text)
asrsDirectoryARN = lens _asrsDirectoryARN (\ s a -> s{_asrsDirectoryARN = a})
asrsAppliedSchemaARN :: Lens' ApplySchemaResponse (Maybe Text)
asrsAppliedSchemaARN = lens _asrsAppliedSchemaARN (\ s a -> s{_asrsAppliedSchemaARN = a})
asrsResponseStatus :: Lens' ApplySchemaResponse Int
asrsResponseStatus = lens _asrsResponseStatus (\ s a -> s{_asrsResponseStatus = a})
instance NFData ApplySchemaResponse where