{-# 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.SMS.GetReplicationRuns
(
getReplicationRuns
, GetReplicationRuns
, grrNextToken
, grrMaxResults
, grrReplicationJobId
, getReplicationRunsResponse
, GetReplicationRunsResponse
, grrrsReplicationJob
, grrrsNextToken
, grrrsReplicationRunList
, grrrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SMS.Types
import Network.AWS.SMS.Types.Product
data GetReplicationRuns = GetReplicationRuns'
{ _grrNextToken :: !(Maybe Text)
, _grrMaxResults :: !(Maybe Int)
, _grrReplicationJobId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getReplicationRuns
:: Text
-> GetReplicationRuns
getReplicationRuns pReplicationJobId_ =
GetReplicationRuns'
{ _grrNextToken = Nothing
, _grrMaxResults = Nothing
, _grrReplicationJobId = pReplicationJobId_
}
grrNextToken :: Lens' GetReplicationRuns (Maybe Text)
grrNextToken = lens _grrNextToken (\ s a -> s{_grrNextToken = a});
grrMaxResults :: Lens' GetReplicationRuns (Maybe Int)
grrMaxResults = lens _grrMaxResults (\ s a -> s{_grrMaxResults = a});
grrReplicationJobId :: Lens' GetReplicationRuns Text
grrReplicationJobId = lens _grrReplicationJobId (\ s a -> s{_grrReplicationJobId = a});
instance AWSRequest GetReplicationRuns where
type Rs GetReplicationRuns =
GetReplicationRunsResponse
request = postJSON sms
response
= receiveJSON
(\ s h x ->
GetReplicationRunsResponse' <$>
(x .?> "replicationJob") <*> (x .?> "nextToken") <*>
(x .?> "replicationRunList" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable GetReplicationRuns
instance NFData GetReplicationRuns
instance ToHeaders GetReplicationRuns where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSServerMigrationService_V2016_10_24.GetReplicationRuns"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetReplicationRuns where
toJSON GetReplicationRuns'{..}
= object
(catMaybes
[("nextToken" .=) <$> _grrNextToken,
("maxResults" .=) <$> _grrMaxResults,
Just ("replicationJobId" .= _grrReplicationJobId)])
instance ToPath GetReplicationRuns where
toPath = const "/"
instance ToQuery GetReplicationRuns where
toQuery = const mempty
data GetReplicationRunsResponse = GetReplicationRunsResponse'
{ _grrrsReplicationJob :: !(Maybe ReplicationJob)
, _grrrsNextToken :: !(Maybe Text)
, _grrrsReplicationRunList :: !(Maybe [ReplicationRun])
, _grrrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getReplicationRunsResponse
:: Int
-> GetReplicationRunsResponse
getReplicationRunsResponse pResponseStatus_ =
GetReplicationRunsResponse'
{ _grrrsReplicationJob = Nothing
, _grrrsNextToken = Nothing
, _grrrsReplicationRunList = Nothing
, _grrrsResponseStatus = pResponseStatus_
}
grrrsReplicationJob :: Lens' GetReplicationRunsResponse (Maybe ReplicationJob)
grrrsReplicationJob = lens _grrrsReplicationJob (\ s a -> s{_grrrsReplicationJob = a});
grrrsNextToken :: Lens' GetReplicationRunsResponse (Maybe Text)
grrrsNextToken = lens _grrrsNextToken (\ s a -> s{_grrrsNextToken = a});
grrrsReplicationRunList :: Lens' GetReplicationRunsResponse [ReplicationRun]
grrrsReplicationRunList = lens _grrrsReplicationRunList (\ s a -> s{_grrrsReplicationRunList = a}) . _Default . _Coerce;
grrrsResponseStatus :: Lens' GetReplicationRunsResponse Int
grrrsResponseStatus = lens _grrrsResponseStatus (\ s a -> s{_grrrsResponseStatus = a});
instance NFData GetReplicationRunsResponse