{-# 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.ListTypedLinkFacetAttributes
(
listTypedLinkFacetAttributes
, ListTypedLinkFacetAttributes
, ltlfaNextToken
, ltlfaMaxResults
, ltlfaSchemaARN
, ltlfaName
, listTypedLinkFacetAttributesResponse
, ListTypedLinkFacetAttributesResponse
, ltlfarsNextToken
, ltlfarsAttributes
, ltlfarsResponseStatus
) where
import Network.AWS.CloudDirectory.Types
import Network.AWS.CloudDirectory.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListTypedLinkFacetAttributes = ListTypedLinkFacetAttributes'
{ _ltlfaNextToken :: !(Maybe Text)
, _ltlfaMaxResults :: !(Maybe Nat)
, _ltlfaSchemaARN :: !Text
, _ltlfaName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTypedLinkFacetAttributes
:: Text
-> Text
-> ListTypedLinkFacetAttributes
listTypedLinkFacetAttributes pSchemaARN_ pName_ =
ListTypedLinkFacetAttributes'
{ _ltlfaNextToken = Nothing
, _ltlfaMaxResults = Nothing
, _ltlfaSchemaARN = pSchemaARN_
, _ltlfaName = pName_
}
ltlfaNextToken :: Lens' ListTypedLinkFacetAttributes (Maybe Text)
ltlfaNextToken = lens _ltlfaNextToken (\ s a -> s{_ltlfaNextToken = a})
ltlfaMaxResults :: Lens' ListTypedLinkFacetAttributes (Maybe Natural)
ltlfaMaxResults = lens _ltlfaMaxResults (\ s a -> s{_ltlfaMaxResults = a}) . mapping _Nat
ltlfaSchemaARN :: Lens' ListTypedLinkFacetAttributes Text
ltlfaSchemaARN = lens _ltlfaSchemaARN (\ s a -> s{_ltlfaSchemaARN = a})
ltlfaName :: Lens' ListTypedLinkFacetAttributes Text
ltlfaName = lens _ltlfaName (\ s a -> s{_ltlfaName = a})
instance AWSPager ListTypedLinkFacetAttributes where
page rq rs
| stop (rs ^. ltlfarsNextToken) = Nothing
| stop (rs ^. ltlfarsAttributes) = Nothing
| otherwise =
Just $ rq & ltlfaNextToken .~ rs ^. ltlfarsNextToken
instance AWSRequest ListTypedLinkFacetAttributes
where
type Rs ListTypedLinkFacetAttributes =
ListTypedLinkFacetAttributesResponse
request = postJSON cloudDirectory
response
= receiveJSON
(\ s h x ->
ListTypedLinkFacetAttributesResponse' <$>
(x .?> "NextToken") <*>
(x .?> "Attributes" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListTypedLinkFacetAttributes where
instance NFData ListTypedLinkFacetAttributes where
instance ToHeaders ListTypedLinkFacetAttributes where
toHeaders ListTypedLinkFacetAttributes'{..}
= mconcat ["x-amz-data-partition" =# _ltlfaSchemaARN]
instance ToJSON ListTypedLinkFacetAttributes where
toJSON ListTypedLinkFacetAttributes'{..}
= object
(catMaybes
[("NextToken" .=) <$> _ltlfaNextToken,
("MaxResults" .=) <$> _ltlfaMaxResults,
Just ("Name" .= _ltlfaName)])
instance ToPath ListTypedLinkFacetAttributes where
toPath
= const
"/amazonclouddirectory/2017-01-11/typedlink/facet/attributes"
instance ToQuery ListTypedLinkFacetAttributes where
toQuery = const mempty
data ListTypedLinkFacetAttributesResponse = ListTypedLinkFacetAttributesResponse'
{ _ltlfarsNextToken :: !(Maybe Text)
, _ltlfarsAttributes :: !(Maybe [TypedLinkAttributeDefinition])
, _ltlfarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listTypedLinkFacetAttributesResponse
:: Int
-> ListTypedLinkFacetAttributesResponse
listTypedLinkFacetAttributesResponse pResponseStatus_ =
ListTypedLinkFacetAttributesResponse'
{ _ltlfarsNextToken = Nothing
, _ltlfarsAttributes = Nothing
, _ltlfarsResponseStatus = pResponseStatus_
}
ltlfarsNextToken :: Lens' ListTypedLinkFacetAttributesResponse (Maybe Text)
ltlfarsNextToken = lens _ltlfarsNextToken (\ s a -> s{_ltlfarsNextToken = a})
ltlfarsAttributes :: Lens' ListTypedLinkFacetAttributesResponse [TypedLinkAttributeDefinition]
ltlfarsAttributes = lens _ltlfarsAttributes (\ s a -> s{_ltlfarsAttributes = a}) . _Default . _Coerce
ltlfarsResponseStatus :: Lens' ListTypedLinkFacetAttributesResponse Int
ltlfarsResponseStatus = lens _ltlfarsResponseStatus (\ s a -> s{_ltlfarsResponseStatus = a})
instance NFData ListTypedLinkFacetAttributesResponse
where