module Network.AWS.StorageGateway.UpdateSnapshotSchedule
    (
    
      UpdateSnapshotSchedule
    
    , updateSnapshotSchedule
    
    , ussDescription
    , ussRecurrenceInHours
    , ussStartAt
    , ussVolumeARN
    
    , UpdateSnapshotScheduleResponse
    
    , updateSnapshotScheduleResponse
    
    , ussrVolumeARN
    ) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.StorageGateway.Types
import qualified GHC.Exts
data UpdateSnapshotSchedule = UpdateSnapshotSchedule
    { _ussDescription       :: Maybe Text
    , _ussRecurrenceInHours :: Nat
    , _ussStartAt           :: Nat
    , _ussVolumeARN         :: Text
    } deriving (Eq, Ord, Read, Show)
updateSnapshotSchedule :: Text 
                       -> Natural 
                       -> Natural 
                       -> UpdateSnapshotSchedule
updateSnapshotSchedule p1 p2 p3 = UpdateSnapshotSchedule
    { _ussVolumeARN         = p1
    , _ussStartAt           = withIso _Nat (const id) p2
    , _ussRecurrenceInHours = withIso _Nat (const id) p3
    , _ussDescription       = Nothing
    }
ussDescription :: Lens' UpdateSnapshotSchedule (Maybe Text)
ussDescription = lens _ussDescription (\s a -> s { _ussDescription = a })
ussRecurrenceInHours :: Lens' UpdateSnapshotSchedule Natural
ussRecurrenceInHours =
    lens _ussRecurrenceInHours (\s a -> s { _ussRecurrenceInHours = a })
        . _Nat
ussStartAt :: Lens' UpdateSnapshotSchedule Natural
ussStartAt = lens _ussStartAt (\s a -> s { _ussStartAt = a }) . _Nat
ussVolumeARN :: Lens' UpdateSnapshotSchedule Text
ussVolumeARN = lens _ussVolumeARN (\s a -> s { _ussVolumeARN = a })
newtype UpdateSnapshotScheduleResponse = UpdateSnapshotScheduleResponse
    { _ussrVolumeARN :: Maybe Text
    } deriving (Eq, Ord, Read, Show, Monoid)
updateSnapshotScheduleResponse :: UpdateSnapshotScheduleResponse
updateSnapshotScheduleResponse = UpdateSnapshotScheduleResponse
    { _ussrVolumeARN = Nothing
    }
ussrVolumeARN :: Lens' UpdateSnapshotScheduleResponse (Maybe Text)
ussrVolumeARN = lens _ussrVolumeARN (\s a -> s { _ussrVolumeARN = a })
instance ToPath UpdateSnapshotSchedule where
    toPath = const "/"
instance ToQuery UpdateSnapshotSchedule where
    toQuery = const mempty
instance ToHeaders UpdateSnapshotSchedule
instance ToJSON UpdateSnapshotSchedule where
    toJSON UpdateSnapshotSchedule{..} = object
        [ "VolumeARN"         .= _ussVolumeARN
        , "StartAt"           .= _ussStartAt
        , "RecurrenceInHours" .= _ussRecurrenceInHours
        , "Description"       .= _ussDescription
        ]
instance AWSRequest UpdateSnapshotSchedule where
    type Sv UpdateSnapshotSchedule = StorageGateway
    type Rs UpdateSnapshotSchedule = UpdateSnapshotScheduleResponse
    request  = post "UpdateSnapshotSchedule"
    response = jsonResponse
instance FromJSON UpdateSnapshotScheduleResponse where
    parseJSON = withObject "UpdateSnapshotScheduleResponse" $ \o -> UpdateSnapshotScheduleResponse
        <$> o .:? "VolumeARN"