module Network.AWS.WorkDocs.CreateCustomMetadata
(
createCustomMetadata
, CreateCustomMetadata
, ccmVersionId
, ccmAuthenticationToken
, ccmResourceId
, ccmCustomMetadata
, createCustomMetadataResponse
, CreateCustomMetadataResponse
, ccmrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkDocs.Types
import Network.AWS.WorkDocs.Types.Product
data CreateCustomMetadata = CreateCustomMetadata'
{ _ccmVersionId :: !(Maybe Text)
, _ccmAuthenticationToken :: !(Maybe (Sensitive Text))
, _ccmResourceId :: !Text
, _ccmCustomMetadata :: !(Map Text Text)
} deriving (Eq, Show, Data, Typeable, Generic)
createCustomMetadata
:: Text
-> CreateCustomMetadata
createCustomMetadata pResourceId_ =
CreateCustomMetadata'
{ _ccmVersionId = Nothing
, _ccmAuthenticationToken = Nothing
, _ccmResourceId = pResourceId_
, _ccmCustomMetadata = mempty
}
ccmVersionId :: Lens' CreateCustomMetadata (Maybe Text)
ccmVersionId = lens _ccmVersionId (\ s a -> s{_ccmVersionId = a});
ccmAuthenticationToken :: Lens' CreateCustomMetadata (Maybe Text)
ccmAuthenticationToken = lens _ccmAuthenticationToken (\ s a -> s{_ccmAuthenticationToken = a}) . mapping _Sensitive;
ccmResourceId :: Lens' CreateCustomMetadata Text
ccmResourceId = lens _ccmResourceId (\ s a -> s{_ccmResourceId = a});
ccmCustomMetadata :: Lens' CreateCustomMetadata (HashMap Text Text)
ccmCustomMetadata = lens _ccmCustomMetadata (\ s a -> s{_ccmCustomMetadata = a}) . _Map;
instance AWSRequest CreateCustomMetadata where
type Rs CreateCustomMetadata =
CreateCustomMetadataResponse
request = putJSON workDocs
response
= receiveEmpty
(\ s h x ->
CreateCustomMetadataResponse' <$>
(pure (fromEnum s)))
instance Hashable CreateCustomMetadata where
instance NFData CreateCustomMetadata where
instance ToHeaders CreateCustomMetadata where
toHeaders CreateCustomMetadata'{..}
= mconcat
["Authentication" =# _ccmAuthenticationToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON CreateCustomMetadata where
toJSON CreateCustomMetadata'{..}
= object
(catMaybes
[Just ("CustomMetadata" .= _ccmCustomMetadata)])
instance ToPath CreateCustomMetadata where
toPath CreateCustomMetadata'{..}
= mconcat
["/api/v1/resources/", toBS _ccmResourceId,
"/customMetadata"]
instance ToQuery CreateCustomMetadata where
toQuery CreateCustomMetadata'{..}
= mconcat ["versionid" =: _ccmVersionId]
newtype CreateCustomMetadataResponse = CreateCustomMetadataResponse'
{ _ccmrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createCustomMetadataResponse
:: Int
-> CreateCustomMetadataResponse
createCustomMetadataResponse pResponseStatus_ =
CreateCustomMetadataResponse' {_ccmrsResponseStatus = pResponseStatus_}
ccmrsResponseStatus :: Lens' CreateCustomMetadataResponse Int
ccmrsResponseStatus = lens _ccmrsResponseStatus (\ s a -> s{_ccmrsResponseStatus = a});
instance NFData CreateCustomMetadataResponse where