{-# 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.CreateNetworkInterfacePermission
(
createNetworkInterfacePermission
, CreateNetworkInterfacePermission
, cnipAWSAccountId
, cnipAWSService
, cnipDryRun
, cnipNetworkInterfaceId
, cnipPermission
, createNetworkInterfacePermissionResponse
, CreateNetworkInterfacePermissionResponse
, cniprsInterfacePermission
, cniprsResponseStatus
) 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 CreateNetworkInterfacePermission = CreateNetworkInterfacePermission'
{ _cnipAWSAccountId :: !(Maybe Text)
, _cnipAWSService :: !(Maybe Text)
, _cnipDryRun :: !(Maybe Bool)
, _cnipNetworkInterfaceId :: !Text
, _cnipPermission :: !InterfacePermissionType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createNetworkInterfacePermission
:: Text
-> InterfacePermissionType
-> CreateNetworkInterfacePermission
createNetworkInterfacePermission pNetworkInterfaceId_ pPermission_ =
CreateNetworkInterfacePermission'
{ _cnipAWSAccountId = Nothing
, _cnipAWSService = Nothing
, _cnipDryRun = Nothing
, _cnipNetworkInterfaceId = pNetworkInterfaceId_
, _cnipPermission = pPermission_
}
cnipAWSAccountId :: Lens' CreateNetworkInterfacePermission (Maybe Text)
cnipAWSAccountId = lens _cnipAWSAccountId (\ s a -> s{_cnipAWSAccountId = a})
cnipAWSService :: Lens' CreateNetworkInterfacePermission (Maybe Text)
cnipAWSService = lens _cnipAWSService (\ s a -> s{_cnipAWSService = a})
cnipDryRun :: Lens' CreateNetworkInterfacePermission (Maybe Bool)
cnipDryRun = lens _cnipDryRun (\ s a -> s{_cnipDryRun = a})
cnipNetworkInterfaceId :: Lens' CreateNetworkInterfacePermission Text
cnipNetworkInterfaceId = lens _cnipNetworkInterfaceId (\ s a -> s{_cnipNetworkInterfaceId = a})
cnipPermission :: Lens' CreateNetworkInterfacePermission InterfacePermissionType
cnipPermission = lens _cnipPermission (\ s a -> s{_cnipPermission = a})
instance AWSRequest CreateNetworkInterfacePermission
where
type Rs CreateNetworkInterfacePermission =
CreateNetworkInterfacePermissionResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CreateNetworkInterfacePermissionResponse' <$>
(x .@? "interfacePermission") <*>
(pure (fromEnum s)))
instance Hashable CreateNetworkInterfacePermission
where
instance NFData CreateNetworkInterfacePermission
where
instance ToHeaders CreateNetworkInterfacePermission
where
toHeaders = const mempty
instance ToPath CreateNetworkInterfacePermission
where
toPath = const "/"
instance ToQuery CreateNetworkInterfacePermission
where
toQuery CreateNetworkInterfacePermission'{..}
= mconcat
["Action" =:
("CreateNetworkInterfacePermission" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"AwsAccountId" =: _cnipAWSAccountId,
"AwsService" =: _cnipAWSService,
"DryRun" =: _cnipDryRun,
"NetworkInterfaceId" =: _cnipNetworkInterfaceId,
"Permission" =: _cnipPermission]
data CreateNetworkInterfacePermissionResponse = CreateNetworkInterfacePermissionResponse'
{ _cniprsInterfacePermission :: !(Maybe NetworkInterfacePermission)
, _cniprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createNetworkInterfacePermissionResponse
:: Int
-> CreateNetworkInterfacePermissionResponse
createNetworkInterfacePermissionResponse pResponseStatus_ =
CreateNetworkInterfacePermissionResponse'
{ _cniprsInterfacePermission = Nothing
, _cniprsResponseStatus = pResponseStatus_
}
cniprsInterfacePermission :: Lens' CreateNetworkInterfacePermissionResponse (Maybe NetworkInterfacePermission)
cniprsInterfacePermission = lens _cniprsInterfacePermission (\ s a -> s{_cniprsInterfacePermission = a})
cniprsResponseStatus :: Lens' CreateNetworkInterfacePermissionResponse Int
cniprsResponseStatus = lens _cniprsResponseStatus (\ s a -> s{_cniprsResponseStatus = a})
instance NFData
CreateNetworkInterfacePermissionResponse
where