{-# 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.DeviceFarm.CreateInstanceProfile
(
createInstanceProfile
, CreateInstanceProfile
, cipRebootAfterUse
, cipPackageCleanup
, cipExcludeAppPackagesFromCleanup
, cipDescription
, cipName
, createInstanceProfileResponse
, CreateInstanceProfileResponse
, ciprsInstanceProfile
, ciprsResponseStatus
) where
import Network.AWS.DeviceFarm.Types
import Network.AWS.DeviceFarm.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateInstanceProfile = CreateInstanceProfile'
{ _cipRebootAfterUse :: !(Maybe Bool)
, _cipPackageCleanup :: !(Maybe Bool)
, _cipExcludeAppPackagesFromCleanup :: !(Maybe [Text])
, _cipDescription :: !(Maybe Text)
, _cipName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createInstanceProfile
:: Text
-> CreateInstanceProfile
createInstanceProfile pName_ =
CreateInstanceProfile'
{ _cipRebootAfterUse = Nothing
, _cipPackageCleanup = Nothing
, _cipExcludeAppPackagesFromCleanup = Nothing
, _cipDescription = Nothing
, _cipName = pName_
}
cipRebootAfterUse :: Lens' CreateInstanceProfile (Maybe Bool)
cipRebootAfterUse = lens _cipRebootAfterUse (\ s a -> s{_cipRebootAfterUse = a})
cipPackageCleanup :: Lens' CreateInstanceProfile (Maybe Bool)
cipPackageCleanup = lens _cipPackageCleanup (\ s a -> s{_cipPackageCleanup = a})
cipExcludeAppPackagesFromCleanup :: Lens' CreateInstanceProfile [Text]
cipExcludeAppPackagesFromCleanup = lens _cipExcludeAppPackagesFromCleanup (\ s a -> s{_cipExcludeAppPackagesFromCleanup = a}) . _Default . _Coerce
cipDescription :: Lens' CreateInstanceProfile (Maybe Text)
cipDescription = lens _cipDescription (\ s a -> s{_cipDescription = a})
cipName :: Lens' CreateInstanceProfile Text
cipName = lens _cipName (\ s a -> s{_cipName = a})
instance AWSRequest CreateInstanceProfile where
type Rs CreateInstanceProfile =
CreateInstanceProfileResponse
request = postJSON deviceFarm
response
= receiveJSON
(\ s h x ->
CreateInstanceProfileResponse' <$>
(x .?> "instanceProfile") <*> (pure (fromEnum s)))
instance Hashable CreateInstanceProfile where
instance NFData CreateInstanceProfile where
instance ToHeaders CreateInstanceProfile where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DeviceFarm_20150623.CreateInstanceProfile" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateInstanceProfile where
toJSON CreateInstanceProfile'{..}
= object
(catMaybes
[("rebootAfterUse" .=) <$> _cipRebootAfterUse,
("packageCleanup" .=) <$> _cipPackageCleanup,
("excludeAppPackagesFromCleanup" .=) <$>
_cipExcludeAppPackagesFromCleanup,
("description" .=) <$> _cipDescription,
Just ("name" .= _cipName)])
instance ToPath CreateInstanceProfile where
toPath = const "/"
instance ToQuery CreateInstanceProfile where
toQuery = const mempty
data CreateInstanceProfileResponse = CreateInstanceProfileResponse'
{ _ciprsInstanceProfile :: !(Maybe InstanceProfile)
, _ciprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createInstanceProfileResponse
:: Int
-> CreateInstanceProfileResponse
createInstanceProfileResponse pResponseStatus_ =
CreateInstanceProfileResponse'
{_ciprsInstanceProfile = Nothing, _ciprsResponseStatus = pResponseStatus_}
ciprsInstanceProfile :: Lens' CreateInstanceProfileResponse (Maybe InstanceProfile)
ciprsInstanceProfile = lens _ciprsInstanceProfile (\ s a -> s{_ciprsInstanceProfile = a})
ciprsResponseStatus :: Lens' CreateInstanceProfileResponse Int
ciprsResponseStatus = lens _ciprsResponseStatus (\ s a -> s{_ciprsResponseStatus = a})
instance NFData CreateInstanceProfileResponse where