{-# 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.Snowball.CreateJob
(
createJob
, CreateJob
, cjKMSKeyARN
, cjNotification
, cjDescription
, cjSnowballCapacityPreference
, cjJobType
, cjResources
, cjAddressId
, cjRoleARN
, cjShippingOption
, createJobResponse
, CreateJobResponse
, cjrsJobId
, cjrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Snowball.Types
import Network.AWS.Snowball.Types.Product
data CreateJob = CreateJob'
{ _cjKMSKeyARN :: !(Maybe Text)
, _cjNotification :: !(Maybe Notification)
, _cjDescription :: !(Maybe Text)
, _cjSnowballCapacityPreference :: !(Maybe SnowballCapacity)
, _cjJobType :: !JobType
, _cjResources :: !JobResource
, _cjAddressId :: !Text
, _cjRoleARN :: !Text
, _cjShippingOption :: !ShippingOption
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createJob
:: JobType
-> JobResource
-> Text
-> Text
-> ShippingOption
-> CreateJob
createJob pJobType_ pResources_ pAddressId_ pRoleARN_ pShippingOption_ =
CreateJob'
{ _cjKMSKeyARN = Nothing
, _cjNotification = Nothing
, _cjDescription = Nothing
, _cjSnowballCapacityPreference = Nothing
, _cjJobType = pJobType_
, _cjResources = pResources_
, _cjAddressId = pAddressId_
, _cjRoleARN = pRoleARN_
, _cjShippingOption = pShippingOption_
}
cjKMSKeyARN :: Lens' CreateJob (Maybe Text)
cjKMSKeyARN = lens _cjKMSKeyARN (\ s a -> s{_cjKMSKeyARN = a});
cjNotification :: Lens' CreateJob (Maybe Notification)
cjNotification = lens _cjNotification (\ s a -> s{_cjNotification = a});
cjDescription :: Lens' CreateJob (Maybe Text)
cjDescription = lens _cjDescription (\ s a -> s{_cjDescription = a});
cjSnowballCapacityPreference :: Lens' CreateJob (Maybe SnowballCapacity)
cjSnowballCapacityPreference = lens _cjSnowballCapacityPreference (\ s a -> s{_cjSnowballCapacityPreference = a});
cjJobType :: Lens' CreateJob JobType
cjJobType = lens _cjJobType (\ s a -> s{_cjJobType = a});
cjResources :: Lens' CreateJob JobResource
cjResources = lens _cjResources (\ s a -> s{_cjResources = a});
cjAddressId :: Lens' CreateJob Text
cjAddressId = lens _cjAddressId (\ s a -> s{_cjAddressId = a});
cjRoleARN :: Lens' CreateJob Text
cjRoleARN = lens _cjRoleARN (\ s a -> s{_cjRoleARN = a});
cjShippingOption :: Lens' CreateJob ShippingOption
cjShippingOption = lens _cjShippingOption (\ s a -> s{_cjShippingOption = a});
instance AWSRequest CreateJob where
type Rs CreateJob = CreateJobResponse
request = postJSON snowball
response
= receiveJSON
(\ s h x ->
CreateJobResponse' <$>
(x .?> "JobId") <*> (pure (fromEnum s)))
instance Hashable CreateJob
instance NFData CreateJob
instance ToHeaders CreateJob where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSIESnowballJobManagementService.CreateJob" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateJob where
toJSON CreateJob'{..}
= object
(catMaybes
[("KmsKeyARN" .=) <$> _cjKMSKeyARN,
("Notification" .=) <$> _cjNotification,
("Description" .=) <$> _cjDescription,
("SnowballCapacityPreference" .=) <$>
_cjSnowballCapacityPreference,
Just ("JobType" .= _cjJobType),
Just ("Resources" .= _cjResources),
Just ("AddressId" .= _cjAddressId),
Just ("RoleARN" .= _cjRoleARN),
Just ("ShippingOption" .= _cjShippingOption)])
instance ToPath CreateJob where
toPath = const "/"
instance ToQuery CreateJob where
toQuery = const mempty
data CreateJobResponse = CreateJobResponse'
{ _cjrsJobId :: !(Maybe Text)
, _cjrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createJobResponse
:: Int
-> CreateJobResponse
createJobResponse pResponseStatus_ =
CreateJobResponse'
{ _cjrsJobId = Nothing
, _cjrsResponseStatus = pResponseStatus_
}
cjrsJobId :: Lens' CreateJobResponse (Maybe Text)
cjrsJobId = lens _cjrsJobId (\ s a -> s{_cjrsJobId = a});
cjrsResponseStatus :: Lens' CreateJobResponse Int
cjrsResponseStatus = lens _cjrsResponseStatus (\ s a -> s{_cjrsResponseStatus = a});
instance NFData CreateJobResponse