{-# 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.EC2.AssociateIAMInstanceProfile
(
associateIAMInstanceProfile
, AssociateIAMInstanceProfile
, aiapIAMInstanceProfile
, aiapInstanceId
, associateIAMInstanceProfileResponse
, AssociateIAMInstanceProfileResponse
, aiaprsIAMInstanceProfileAssociation
, aiaprsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data AssociateIAMInstanceProfile = AssociateIAMInstanceProfile'
{ _aiapIAMInstanceProfile :: !IAMInstanceProfileSpecification
, _aiapInstanceId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
associateIAMInstanceProfile
:: IAMInstanceProfileSpecification
-> Text
-> AssociateIAMInstanceProfile
associateIAMInstanceProfile pIAMInstanceProfile_ pInstanceId_ =
AssociateIAMInstanceProfile'
{ _aiapIAMInstanceProfile = pIAMInstanceProfile_
, _aiapInstanceId = pInstanceId_
}
aiapIAMInstanceProfile :: Lens' AssociateIAMInstanceProfile IAMInstanceProfileSpecification
aiapIAMInstanceProfile = lens _aiapIAMInstanceProfile (\ s a -> s{_aiapIAMInstanceProfile = a})
aiapInstanceId :: Lens' AssociateIAMInstanceProfile Text
aiapInstanceId = lens _aiapInstanceId (\ s a -> s{_aiapInstanceId = a})
instance AWSRequest AssociateIAMInstanceProfile where
type Rs AssociateIAMInstanceProfile =
AssociateIAMInstanceProfileResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
AssociateIAMInstanceProfileResponse' <$>
(x .@? "iamInstanceProfileAssociation") <*>
(pure (fromEnum s)))
instance Hashable AssociateIAMInstanceProfile where
instance NFData AssociateIAMInstanceProfile where
instance ToHeaders AssociateIAMInstanceProfile where
toHeaders = const mempty
instance ToPath AssociateIAMInstanceProfile where
toPath = const "/"
instance ToQuery AssociateIAMInstanceProfile where
toQuery AssociateIAMInstanceProfile'{..}
= mconcat
["Action" =:
("AssociateIamInstanceProfile" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"IamInstanceProfile" =: _aiapIAMInstanceProfile,
"InstanceId" =: _aiapInstanceId]
data AssociateIAMInstanceProfileResponse = AssociateIAMInstanceProfileResponse'
{ _aiaprsIAMInstanceProfileAssociation :: !(Maybe IAMInstanceProfileAssociation)
, _aiaprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
associateIAMInstanceProfileResponse
:: Int
-> AssociateIAMInstanceProfileResponse
associateIAMInstanceProfileResponse pResponseStatus_ =
AssociateIAMInstanceProfileResponse'
{ _aiaprsIAMInstanceProfileAssociation = Nothing
, _aiaprsResponseStatus = pResponseStatus_
}
aiaprsIAMInstanceProfileAssociation :: Lens' AssociateIAMInstanceProfileResponse (Maybe IAMInstanceProfileAssociation)
aiaprsIAMInstanceProfileAssociation = lens _aiaprsIAMInstanceProfileAssociation (\ s a -> s{_aiaprsIAMInstanceProfileAssociation = a})
aiaprsResponseStatus :: Lens' AssociateIAMInstanceProfileResponse Int
aiaprsResponseStatus = lens _aiaprsResponseStatus (\ s a -> s{_aiaprsResponseStatus = a})
instance NFData AssociateIAMInstanceProfileResponse
where