{-# 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.SSM.CreateMaintenanceWindow
(
createMaintenanceWindow
, CreateMaintenanceWindow
, cmwClientToken
, cmwDescription
, cmwName
, cmwSchedule
, cmwDuration
, cmwCutoff
, cmwAllowUnassociatedTargets
, createMaintenanceWindowResponse
, CreateMaintenanceWindowResponse
, cmwrsWindowId
, cmwrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SSM.Types
import Network.AWS.SSM.Types.Product
data CreateMaintenanceWindow = CreateMaintenanceWindow'
{ _cmwClientToken :: !(Maybe Text)
, _cmwDescription :: !(Maybe (Sensitive Text))
, _cmwName :: !Text
, _cmwSchedule :: !Text
, _cmwDuration :: !Nat
, _cmwCutoff :: !Nat
, _cmwAllowUnassociatedTargets :: !Bool
} deriving (Eq, Show, Data, Typeable, Generic)
createMaintenanceWindow
:: Text
-> Text
-> Natural
-> Natural
-> Bool
-> CreateMaintenanceWindow
createMaintenanceWindow pName_ pSchedule_ pDuration_ pCutoff_ pAllowUnassociatedTargets_ =
CreateMaintenanceWindow'
{ _cmwClientToken = Nothing
, _cmwDescription = Nothing
, _cmwName = pName_
, _cmwSchedule = pSchedule_
, _cmwDuration = _Nat # pDuration_
, _cmwCutoff = _Nat # pCutoff_
, _cmwAllowUnassociatedTargets = pAllowUnassociatedTargets_
}
cmwClientToken :: Lens' CreateMaintenanceWindow (Maybe Text)
cmwClientToken = lens _cmwClientToken (\ s a -> s{_cmwClientToken = a})
cmwDescription :: Lens' CreateMaintenanceWindow (Maybe Text)
cmwDescription = lens _cmwDescription (\ s a -> s{_cmwDescription = a}) . mapping _Sensitive
cmwName :: Lens' CreateMaintenanceWindow Text
cmwName = lens _cmwName (\ s a -> s{_cmwName = a})
cmwSchedule :: Lens' CreateMaintenanceWindow Text
cmwSchedule = lens _cmwSchedule (\ s a -> s{_cmwSchedule = a})
cmwDuration :: Lens' CreateMaintenanceWindow Natural
cmwDuration = lens _cmwDuration (\ s a -> s{_cmwDuration = a}) . _Nat
cmwCutoff :: Lens' CreateMaintenanceWindow Natural
cmwCutoff = lens _cmwCutoff (\ s a -> s{_cmwCutoff = a}) . _Nat
cmwAllowUnassociatedTargets :: Lens' CreateMaintenanceWindow Bool
cmwAllowUnassociatedTargets = lens _cmwAllowUnassociatedTargets (\ s a -> s{_cmwAllowUnassociatedTargets = a})
instance AWSRequest CreateMaintenanceWindow where
type Rs CreateMaintenanceWindow =
CreateMaintenanceWindowResponse
request = postJSON ssm
response
= receiveJSON
(\ s h x ->
CreateMaintenanceWindowResponse' <$>
(x .?> "WindowId") <*> (pure (fromEnum s)))
instance Hashable CreateMaintenanceWindow where
instance NFData CreateMaintenanceWindow where
instance ToHeaders CreateMaintenanceWindow where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonSSM.CreateMaintenanceWindow" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateMaintenanceWindow where
toJSON CreateMaintenanceWindow'{..}
= object
(catMaybes
[("ClientToken" .=) <$> _cmwClientToken,
("Description" .=) <$> _cmwDescription,
Just ("Name" .= _cmwName),
Just ("Schedule" .= _cmwSchedule),
Just ("Duration" .= _cmwDuration),
Just ("Cutoff" .= _cmwCutoff),
Just
("AllowUnassociatedTargets" .=
_cmwAllowUnassociatedTargets)])
instance ToPath CreateMaintenanceWindow where
toPath = const "/"
instance ToQuery CreateMaintenanceWindow where
toQuery = const mempty
data CreateMaintenanceWindowResponse = CreateMaintenanceWindowResponse'
{ _cmwrsWindowId :: !(Maybe Text)
, _cmwrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createMaintenanceWindowResponse
:: Int
-> CreateMaintenanceWindowResponse
createMaintenanceWindowResponse pResponseStatus_ =
CreateMaintenanceWindowResponse'
{_cmwrsWindowId = Nothing, _cmwrsResponseStatus = pResponseStatus_}
cmwrsWindowId :: Lens' CreateMaintenanceWindowResponse (Maybe Text)
cmwrsWindowId = lens _cmwrsWindowId (\ s a -> s{_cmwrsWindowId = a})
cmwrsResponseStatus :: Lens' CreateMaintenanceWindowResponse Int
cmwrsResponseStatus = lens _cmwrsResponseStatus (\ s a -> s{_cmwrsResponseStatus = a})
instance NFData CreateMaintenanceWindowResponse where