{-# 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.CodeDeploy.BatchGetDeploymentInstances
(
batchGetDeploymentInstances
, BatchGetDeploymentInstances
, bgdiDeploymentId
, bgdiInstanceIds
, batchGetDeploymentInstancesResponse
, BatchGetDeploymentInstancesResponse
, bgdirsInstancesSummary
, bgdirsErrorMessage
, bgdirsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data BatchGetDeploymentInstances = BatchGetDeploymentInstances'
{ _bgdiDeploymentId :: !Text
, _bgdiInstanceIds :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetDeploymentInstances
:: Text
-> BatchGetDeploymentInstances
batchGetDeploymentInstances pDeploymentId_ =
BatchGetDeploymentInstances'
{_bgdiDeploymentId = pDeploymentId_, _bgdiInstanceIds = mempty}
bgdiDeploymentId :: Lens' BatchGetDeploymentInstances Text
bgdiDeploymentId = lens _bgdiDeploymentId (\ s a -> s{_bgdiDeploymentId = a})
bgdiInstanceIds :: Lens' BatchGetDeploymentInstances [Text]
bgdiInstanceIds = lens _bgdiInstanceIds (\ s a -> s{_bgdiInstanceIds = a}) . _Coerce
instance AWSRequest BatchGetDeploymentInstances where
type Rs BatchGetDeploymentInstances =
BatchGetDeploymentInstancesResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
BatchGetDeploymentInstancesResponse' <$>
(x .?> "instancesSummary" .!@ mempty) <*>
(x .?> "errorMessage")
<*> (pure (fromEnum s)))
instance Hashable BatchGetDeploymentInstances where
instance NFData BatchGetDeploymentInstances where
instance ToHeaders BatchGetDeploymentInstances where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.BatchGetDeploymentInstances" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchGetDeploymentInstances where
toJSON BatchGetDeploymentInstances'{..}
= object
(catMaybes
[Just ("deploymentId" .= _bgdiDeploymentId),
Just ("instanceIds" .= _bgdiInstanceIds)])
instance ToPath BatchGetDeploymentInstances where
toPath = const "/"
instance ToQuery BatchGetDeploymentInstances where
toQuery = const mempty
data BatchGetDeploymentInstancesResponse = BatchGetDeploymentInstancesResponse'
{ _bgdirsInstancesSummary :: !(Maybe [InstanceSummary])
, _bgdirsErrorMessage :: !(Maybe Text)
, _bgdirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetDeploymentInstancesResponse
:: Int
-> BatchGetDeploymentInstancesResponse
batchGetDeploymentInstancesResponse pResponseStatus_ =
BatchGetDeploymentInstancesResponse'
{ _bgdirsInstancesSummary = Nothing
, _bgdirsErrorMessage = Nothing
, _bgdirsResponseStatus = pResponseStatus_
}
bgdirsInstancesSummary :: Lens' BatchGetDeploymentInstancesResponse [InstanceSummary]
bgdirsInstancesSummary = lens _bgdirsInstancesSummary (\ s a -> s{_bgdirsInstancesSummary = a}) . _Default . _Coerce
bgdirsErrorMessage :: Lens' BatchGetDeploymentInstancesResponse (Maybe Text)
bgdirsErrorMessage = lens _bgdirsErrorMessage (\ s a -> s{_bgdirsErrorMessage = a})
bgdirsResponseStatus :: Lens' BatchGetDeploymentInstancesResponse Int
bgdirsResponseStatus = lens _bgdirsResponseStatus (\ s a -> s{_bgdirsResponseStatus = a})
instance NFData BatchGetDeploymentInstancesResponse
where