module Network.AWS.StorageGateway.UpdateSnapshotSchedule
    (
    
      updateSnapshotSchedule
    , UpdateSnapshotSchedule
    
    , ussDescription
    , ussVolumeARN
    , ussStartAt
    , ussRecurrenceInHours
    
    , updateSnapshotScheduleResponse
    , UpdateSnapshotScheduleResponse
    
    , ussrsVolumeARN
    , ussrsStatus
    ) where
import           Network.AWS.Prelude
import           Network.AWS.Request
import           Network.AWS.Response
import           Network.AWS.StorageGateway.Types
import           Network.AWS.StorageGateway.Types.Product
data UpdateSnapshotSchedule = UpdateSnapshotSchedule'
    { _ussDescription       :: !(Maybe Text)
    , _ussVolumeARN         :: !Text
    , _ussStartAt           :: !Nat
    , _ussRecurrenceInHours :: !Nat
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
updateSnapshotSchedule
    :: Text 
    -> Natural 
    -> Natural 
    -> UpdateSnapshotSchedule
updateSnapshotSchedule pVolumeARN_ pStartAt_ pRecurrenceInHours_ =
    UpdateSnapshotSchedule'
    { _ussDescription = Nothing
    , _ussVolumeARN = pVolumeARN_
    , _ussStartAt = _Nat # pStartAt_
    , _ussRecurrenceInHours = _Nat # pRecurrenceInHours_
    }
ussDescription :: Lens' UpdateSnapshotSchedule (Maybe Text)
ussDescription = lens _ussDescription (\ s a -> s{_ussDescription = a});
ussVolumeARN :: Lens' UpdateSnapshotSchedule Text
ussVolumeARN = lens _ussVolumeARN (\ s a -> s{_ussVolumeARN = a});
ussStartAt :: Lens' UpdateSnapshotSchedule Natural
ussStartAt = lens _ussStartAt (\ s a -> s{_ussStartAt = a}) . _Nat;
ussRecurrenceInHours :: Lens' UpdateSnapshotSchedule Natural
ussRecurrenceInHours = lens _ussRecurrenceInHours (\ s a -> s{_ussRecurrenceInHours = a}) . _Nat;
instance AWSRequest UpdateSnapshotSchedule where
        type Rs UpdateSnapshotSchedule =
             UpdateSnapshotScheduleResponse
        request = postJSON storageGateway
        response
          = receiveJSON
              (\ s h x ->
                 UpdateSnapshotScheduleResponse' <$>
                   (x .?> "VolumeARN") <*> (pure (fromEnum s)))
instance ToHeaders UpdateSnapshotSchedule where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("StorageGateway_20130630.UpdateSnapshotSchedule" ::
                       ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateSnapshotSchedule where
        toJSON UpdateSnapshotSchedule'{..}
          = object
              (catMaybes
                 [("Description" .=) <$> _ussDescription,
                  Just ("VolumeARN" .= _ussVolumeARN),
                  Just ("StartAt" .= _ussStartAt),
                  Just ("RecurrenceInHours" .= _ussRecurrenceInHours)])
instance ToPath UpdateSnapshotSchedule where
        toPath = const "/"
instance ToQuery UpdateSnapshotSchedule where
        toQuery = const mempty
data UpdateSnapshotScheduleResponse = UpdateSnapshotScheduleResponse'
    { _ussrsVolumeARN :: !(Maybe Text)
    , _ussrsStatus    :: !Int
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
updateSnapshotScheduleResponse
    :: Int 
    -> UpdateSnapshotScheduleResponse
updateSnapshotScheduleResponse pStatus_ =
    UpdateSnapshotScheduleResponse'
    { _ussrsVolumeARN = Nothing
    , _ussrsStatus = pStatus_
    }
ussrsVolumeARN :: Lens' UpdateSnapshotScheduleResponse (Maybe Text)
ussrsVolumeARN = lens _ussrsVolumeARN (\ s a -> s{_ussrsVolumeARN = a});
ussrsStatus :: Lens' UpdateSnapshotScheduleResponse Int
ussrsStatus = lens _ussrsStatus (\ s a -> s{_ussrsStatus = a});