module Network.AWS.CloudDirectory.ListFacetAttributes
(
listFacetAttributes
, ListFacetAttributes
, lfaNextToken
, lfaMaxResults
, lfaSchemaARN
, lfaName
, listFacetAttributesResponse
, ListFacetAttributesResponse
, lfarsNextToken
, lfarsAttributes
, lfarsResponseStatus
) 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 ListFacetAttributes = ListFacetAttributes'
{ _lfaNextToken :: !(Maybe Text)
, _lfaMaxResults :: !(Maybe Nat)
, _lfaSchemaARN :: !Text
, _lfaName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listFacetAttributes
:: Text
-> Text
-> ListFacetAttributes
listFacetAttributes pSchemaARN_ pName_ =
ListFacetAttributes'
{ _lfaNextToken = Nothing
, _lfaMaxResults = Nothing
, _lfaSchemaARN = pSchemaARN_
, _lfaName = pName_
}
lfaNextToken :: Lens' ListFacetAttributes (Maybe Text)
lfaNextToken = lens _lfaNextToken (\ s a -> s{_lfaNextToken = a});
lfaMaxResults :: Lens' ListFacetAttributes (Maybe Natural)
lfaMaxResults = lens _lfaMaxResults (\ s a -> s{_lfaMaxResults = a}) . mapping _Nat;
lfaSchemaARN :: Lens' ListFacetAttributes Text
lfaSchemaARN = lens _lfaSchemaARN (\ s a -> s{_lfaSchemaARN = a});
lfaName :: Lens' ListFacetAttributes Text
lfaName = lens _lfaName (\ s a -> s{_lfaName = a});
instance AWSRequest ListFacetAttributes where
type Rs ListFacetAttributes =
ListFacetAttributesResponse
request = postJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
ListFacetAttributesResponse' <$>
(x .?> "NextToken") <*>
(x .?> "Attributes" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListFacetAttributes where
instance NFData ListFacetAttributes where
instance ToHeaders ListFacetAttributes where
toHeaders ListFacetAttributes'{..}
= mconcat ["x-amz-data-partition" =# _lfaSchemaARN]
instance ToJSON ListFacetAttributes where
toJSON ListFacetAttributes'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lfaNextToken,
("MaxResults" .=) <$> _lfaMaxResults,
Just ("Name" .= _lfaName)])
instance ToPath ListFacetAttributes where
toPath
= const
"/amazonclouddirectory/2017-01-11/facet/attributes"
instance ToQuery ListFacetAttributes where
toQuery = const mempty
data ListFacetAttributesResponse = ListFacetAttributesResponse'
{ _lfarsNextToken :: !(Maybe Text)
, _lfarsAttributes :: !(Maybe [FacetAttribute])
, _lfarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listFacetAttributesResponse
:: Int
-> ListFacetAttributesResponse
listFacetAttributesResponse pResponseStatus_ =
ListFacetAttributesResponse'
{ _lfarsNextToken = Nothing
, _lfarsAttributes = Nothing
, _lfarsResponseStatus = pResponseStatus_
}
lfarsNextToken :: Lens' ListFacetAttributesResponse (Maybe Text)
lfarsNextToken = lens _lfarsNextToken (\ s a -> s{_lfarsNextToken = a});
lfarsAttributes :: Lens' ListFacetAttributesResponse [FacetAttribute]
lfarsAttributes = lens _lfarsAttributes (\ s a -> s{_lfarsAttributes = a}) . _Default . _Coerce;
lfarsResponseStatus :: Lens' ListFacetAttributesResponse Int
lfarsResponseStatus = lens _lfarsResponseStatus (\ s a -> s{_lfarsResponseStatus = a});
instance NFData ListFacetAttributesResponse where