{-# 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.Lightsail.CreateInstancesFromSnapshot
(
createInstancesFromSnapshot
, CreateInstancesFromSnapshot
, cifsUserData
, cifsKeyPairName
, cifsInstanceNames
, cifsAvailabilityZone
, cifsInstanceSnapshotName
, cifsBundleId
, createInstancesFromSnapshotResponse
, CreateInstancesFromSnapshotResponse
, cifsrsOperations
, cifsrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Lightsail.Types
import Network.AWS.Lightsail.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateInstancesFromSnapshot = CreateInstancesFromSnapshot'
{ _cifsUserData :: !(Maybe Text)
, _cifsKeyPairName :: !(Maybe Text)
, _cifsInstanceNames :: ![Text]
, _cifsAvailabilityZone :: !Text
, _cifsInstanceSnapshotName :: !Text
, _cifsBundleId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createInstancesFromSnapshot
:: Text
-> Text
-> Text
-> CreateInstancesFromSnapshot
createInstancesFromSnapshot pAvailabilityZone_ pInstanceSnapshotName_ pBundleId_ =
CreateInstancesFromSnapshot'
{ _cifsUserData = Nothing
, _cifsKeyPairName = Nothing
, _cifsInstanceNames = mempty
, _cifsAvailabilityZone = pAvailabilityZone_
, _cifsInstanceSnapshotName = pInstanceSnapshotName_
, _cifsBundleId = pBundleId_
}
cifsUserData :: Lens' CreateInstancesFromSnapshot (Maybe Text)
cifsUserData = lens _cifsUserData (\ s a -> s{_cifsUserData = a});
cifsKeyPairName :: Lens' CreateInstancesFromSnapshot (Maybe Text)
cifsKeyPairName = lens _cifsKeyPairName (\ s a -> s{_cifsKeyPairName = a});
cifsInstanceNames :: Lens' CreateInstancesFromSnapshot [Text]
cifsInstanceNames = lens _cifsInstanceNames (\ s a -> s{_cifsInstanceNames = a}) . _Coerce;
cifsAvailabilityZone :: Lens' CreateInstancesFromSnapshot Text
cifsAvailabilityZone = lens _cifsAvailabilityZone (\ s a -> s{_cifsAvailabilityZone = a});
cifsInstanceSnapshotName :: Lens' CreateInstancesFromSnapshot Text
cifsInstanceSnapshotName = lens _cifsInstanceSnapshotName (\ s a -> s{_cifsInstanceSnapshotName = a});
cifsBundleId :: Lens' CreateInstancesFromSnapshot Text
cifsBundleId = lens _cifsBundleId (\ s a -> s{_cifsBundleId = a});
instance AWSRequest CreateInstancesFromSnapshot where
type Rs CreateInstancesFromSnapshot =
CreateInstancesFromSnapshotResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
CreateInstancesFromSnapshotResponse' <$>
(x .?> "operations" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable CreateInstancesFromSnapshot
instance NFData CreateInstancesFromSnapshot
instance ToHeaders CreateInstancesFromSnapshot where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.CreateInstancesFromSnapshot" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateInstancesFromSnapshot where
toJSON CreateInstancesFromSnapshot'{..}
= object
(catMaybes
[("userData" .=) <$> _cifsUserData,
("keyPairName" .=) <$> _cifsKeyPairName,
Just ("instanceNames" .= _cifsInstanceNames),
Just ("availabilityZone" .= _cifsAvailabilityZone),
Just
("instanceSnapshotName" .=
_cifsInstanceSnapshotName),
Just ("bundleId" .= _cifsBundleId)])
instance ToPath CreateInstancesFromSnapshot where
toPath = const "/"
instance ToQuery CreateInstancesFromSnapshot where
toQuery = const mempty
data CreateInstancesFromSnapshotResponse = CreateInstancesFromSnapshotResponse'
{ _cifsrsOperations :: !(Maybe [Operation])
, _cifsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createInstancesFromSnapshotResponse
:: Int
-> CreateInstancesFromSnapshotResponse
createInstancesFromSnapshotResponse pResponseStatus_ =
CreateInstancesFromSnapshotResponse'
{ _cifsrsOperations = Nothing
, _cifsrsResponseStatus = pResponseStatus_
}
cifsrsOperations :: Lens' CreateInstancesFromSnapshotResponse [Operation]
cifsrsOperations = lens _cifsrsOperations (\ s a -> s{_cifsrsOperations = a}) . _Default . _Coerce;
cifsrsResponseStatus :: Lens' CreateInstancesFromSnapshotResponse Int
cifsrsResponseStatus = lens _cifsrsResponseStatus (\ s a -> s{_cifsrsResponseStatus = a});
instance NFData CreateInstancesFromSnapshotResponse