{-# 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.CodeBuild.BatchGetProjects
(
batchGetProjects
, BatchGetProjects
, bgpNames
, batchGetProjectsResponse
, BatchGetProjectsResponse
, bgprsProjectsNotFound
, bgprsProjects
, bgprsResponseStatus
) where
import Network.AWS.CodeBuild.Types
import Network.AWS.CodeBuild.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype BatchGetProjects = BatchGetProjects'
{ _bgpNames :: List1 Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetProjects
:: NonEmpty Text
-> BatchGetProjects
batchGetProjects pNames_ = BatchGetProjects' {_bgpNames = _List1 # pNames_}
bgpNames :: Lens' BatchGetProjects (NonEmpty Text)
bgpNames = lens _bgpNames (\ s a -> s{_bgpNames = a}) . _List1
instance AWSRequest BatchGetProjects where
type Rs BatchGetProjects = BatchGetProjectsResponse
request = postJSON codeBuild
response
= receiveJSON
(\ s h x ->
BatchGetProjectsResponse' <$>
(x .?> "projectsNotFound") <*>
(x .?> "projects" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable BatchGetProjects where
instance NFData BatchGetProjects where
instance ToHeaders BatchGetProjects where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeBuild_20161006.BatchGetProjects" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchGetProjects where
toJSON BatchGetProjects'{..}
= object (catMaybes [Just ("names" .= _bgpNames)])
instance ToPath BatchGetProjects where
toPath = const "/"
instance ToQuery BatchGetProjects where
toQuery = const mempty
data BatchGetProjectsResponse = BatchGetProjectsResponse'
{ _bgprsProjectsNotFound :: !(Maybe (List1 Text))
, _bgprsProjects :: !(Maybe [Project])
, _bgprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchGetProjectsResponse
:: Int
-> BatchGetProjectsResponse
batchGetProjectsResponse pResponseStatus_ =
BatchGetProjectsResponse'
{ _bgprsProjectsNotFound = Nothing
, _bgprsProjects = Nothing
, _bgprsResponseStatus = pResponseStatus_
}
bgprsProjectsNotFound :: Lens' BatchGetProjectsResponse (Maybe (NonEmpty Text))
bgprsProjectsNotFound = lens _bgprsProjectsNotFound (\ s a -> s{_bgprsProjectsNotFound = a}) . mapping _List1
bgprsProjects :: Lens' BatchGetProjectsResponse [Project]
bgprsProjects = lens _bgprsProjects (\ s a -> s{_bgprsProjects = a}) . _Default . _Coerce
bgprsResponseStatus :: Lens' BatchGetProjectsResponse Int
bgprsResponseStatus = lens _bgprsResponseStatus (\ s a -> s{_bgprsResponseStatus = a})
instance NFData BatchGetProjectsResponse where