{-# 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.UpdateFacet
(
updateFacet
, UpdateFacet
, ufObjectType
, ufAttributeUpdates
, ufSchemaARN
, ufName
, updateFacetResponse
, UpdateFacetResponse
, ufrsResponseStatus
) 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 UpdateFacet = UpdateFacet'
{ _ufObjectType :: !(Maybe ObjectType)
, _ufAttributeUpdates :: !(Maybe [FacetAttributeUpdate])
, _ufSchemaARN :: !Text
, _ufName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateFacet
:: Text
-> Text
-> UpdateFacet
updateFacet pSchemaARN_ pName_ =
UpdateFacet'
{ _ufObjectType = Nothing
, _ufAttributeUpdates = Nothing
, _ufSchemaARN = pSchemaARN_
, _ufName = pName_
}
ufObjectType :: Lens' UpdateFacet (Maybe ObjectType)
ufObjectType = lens _ufObjectType (\ s a -> s{_ufObjectType = a})
ufAttributeUpdates :: Lens' UpdateFacet [FacetAttributeUpdate]
ufAttributeUpdates = lens _ufAttributeUpdates (\ s a -> s{_ufAttributeUpdates = a}) . _Default . _Coerce
ufSchemaARN :: Lens' UpdateFacet Text
ufSchemaARN = lens _ufSchemaARN (\ s a -> s{_ufSchemaARN = a})
ufName :: Lens' UpdateFacet Text
ufName = lens _ufName (\ s a -> s{_ufName = a})
instance AWSRequest UpdateFacet where
type Rs UpdateFacet = UpdateFacetResponse
request = putJSON cloudDirectory
response
= receiveEmpty
(\ s h x ->
UpdateFacetResponse' <$> (pure (fromEnum s)))
instance Hashable UpdateFacet where
instance NFData UpdateFacet where
instance ToHeaders UpdateFacet where
toHeaders UpdateFacet'{..}
= mconcat ["x-amz-data-partition" =# _ufSchemaARN]
instance ToJSON UpdateFacet where
toJSON UpdateFacet'{..}
= object
(catMaybes
[("ObjectType" .=) <$> _ufObjectType,
("AttributeUpdates" .=) <$> _ufAttributeUpdates,
Just ("Name" .= _ufName)])
instance ToPath UpdateFacet where
toPath
= const "/amazonclouddirectory/2017-01-11/facet"
instance ToQuery UpdateFacet where
toQuery = const mempty
newtype UpdateFacetResponse = UpdateFacetResponse'
{ _ufrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateFacetResponse
:: Int
-> UpdateFacetResponse
updateFacetResponse pResponseStatus_ =
UpdateFacetResponse' {_ufrsResponseStatus = pResponseStatus_}
ufrsResponseStatus :: Lens' UpdateFacetResponse Int
ufrsResponseStatus = lens _ufrsResponseStatus (\ s a -> s{_ufrsResponseStatus = a})
instance NFData UpdateFacetResponse where