{-# 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.IoT.AttachPolicy
(
attachPolicy
, AttachPolicy
, apPolicyName
, apTarget
, attachPolicyResponse
, AttachPolicyResponse
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data AttachPolicy = AttachPolicy'
{ _apPolicyName :: !Text
, _apTarget :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
attachPolicy
:: Text
-> Text
-> AttachPolicy
attachPolicy pPolicyName_ pTarget_ =
AttachPolicy' {_apPolicyName = pPolicyName_, _apTarget = pTarget_}
apPolicyName :: Lens' AttachPolicy Text
apPolicyName = lens _apPolicyName (\ s a -> s{_apPolicyName = a})
apTarget :: Lens' AttachPolicy Text
apTarget = lens _apTarget (\ s a -> s{_apTarget = a})
instance AWSRequest AttachPolicy where
type Rs AttachPolicy = AttachPolicyResponse
request = putJSON ioT
response = receiveNull AttachPolicyResponse'
instance Hashable AttachPolicy where
instance NFData AttachPolicy where
instance ToHeaders AttachPolicy where
toHeaders = const mempty
instance ToJSON AttachPolicy where
toJSON AttachPolicy'{..}
= object (catMaybes [Just ("target" .= _apTarget)])
instance ToPath AttachPolicy where
toPath AttachPolicy'{..}
= mconcat ["/target-policies/", toBS _apPolicyName]
instance ToQuery AttachPolicy where
toQuery = const mempty
data AttachPolicyResponse =
AttachPolicyResponse'
deriving (Eq, Read, Show, Data, Typeable, Generic)
attachPolicyResponse
:: AttachPolicyResponse
attachPolicyResponse = AttachPolicyResponse'
instance NFData AttachPolicyResponse where