module Network.AWS.CloudDirectory.PublishSchema
(
publishSchema
, PublishSchema
, psName
, psDevelopmentSchemaARN
, psVersion
, publishSchemaResponse
, PublishSchemaResponse
, psrsPublishedSchemaARN
, psrsResponseStatus
) 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 PublishSchema = PublishSchema'
{ _psName :: !(Maybe Text)
, _psDevelopmentSchemaARN :: !Text
, _psVersion :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
publishSchema
:: Text
-> Text
-> PublishSchema
publishSchema pDevelopmentSchemaARN_ pVersion_ =
PublishSchema'
{ _psName = Nothing
, _psDevelopmentSchemaARN = pDevelopmentSchemaARN_
, _psVersion = pVersion_
}
psName :: Lens' PublishSchema (Maybe Text)
psName = lens _psName (\ s a -> s{_psName = a});
psDevelopmentSchemaARN :: Lens' PublishSchema Text
psDevelopmentSchemaARN = lens _psDevelopmentSchemaARN (\ s a -> s{_psDevelopmentSchemaARN = a});
psVersion :: Lens' PublishSchema Text
psVersion = lens _psVersion (\ s a -> s{_psVersion = a});
instance AWSRequest PublishSchema where
type Rs PublishSchema = PublishSchemaResponse
request = putJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
PublishSchemaResponse' <$>
(x .?> "PublishedSchemaArn") <*> (pure (fromEnum s)))
instance Hashable PublishSchema where
instance NFData PublishSchema where
instance ToHeaders PublishSchema where
toHeaders PublishSchema'{..}
= mconcat
["x-amz-data-partition" =# _psDevelopmentSchemaARN]
instance ToJSON PublishSchema where
toJSON PublishSchema'{..}
= object
(catMaybes
[("Name" .=) <$> _psName,
Just ("Version" .= _psVersion)])
instance ToPath PublishSchema where
toPath
= const
"/amazonclouddirectory/2017-01-11/schema/publish"
instance ToQuery PublishSchema where
toQuery = const mempty
data PublishSchemaResponse = PublishSchemaResponse'
{ _psrsPublishedSchemaARN :: !(Maybe Text)
, _psrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
publishSchemaResponse
:: Int
-> PublishSchemaResponse
publishSchemaResponse pResponseStatus_ =
PublishSchemaResponse'
{_psrsPublishedSchemaARN = Nothing, _psrsResponseStatus = pResponseStatus_}
psrsPublishedSchemaARN :: Lens' PublishSchemaResponse (Maybe Text)
psrsPublishedSchemaARN = lens _psrsPublishedSchemaARN (\ s a -> s{_psrsPublishedSchemaARN = a});
psrsResponseStatus :: Lens' PublishSchemaResponse Int
psrsResponseStatus = lens _psrsResponseStatus (\ s a -> s{_psrsResponseStatus = a});
instance NFData PublishSchemaResponse where