{-# 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.CreateProject
(
createProject
, CreateProject
, cpBadgeEnabled
, cpCache
, cpVpcConfig
, cpEncryptionKey
, cpDescription
, cpServiceRole
, cpTags
, cpTimeoutInMinutes
, cpName
, cpSource
, cpArtifacts
, cpEnvironment
, createProjectResponse
, CreateProjectResponse
, cprsProject
, cprsResponseStatus
) 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
data CreateProject = CreateProject'
{ _cpBadgeEnabled :: !(Maybe Bool)
, _cpCache :: !(Maybe ProjectCache)
, _cpVpcConfig :: !(Maybe VPCConfig)
, _cpEncryptionKey :: !(Maybe Text)
, _cpDescription :: !(Maybe Text)
, _cpServiceRole :: !(Maybe Text)
, _cpTags :: !(Maybe [Tag])
, _cpTimeoutInMinutes :: !(Maybe Nat)
, _cpName :: !Text
, _cpSource :: !ProjectSource
, _cpArtifacts :: !ProjectArtifacts
, _cpEnvironment :: !ProjectEnvironment
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createProject
:: Text
-> ProjectSource
-> ProjectArtifacts
-> ProjectEnvironment
-> CreateProject
createProject pName_ pSource_ pArtifacts_ pEnvironment_ =
CreateProject'
{ _cpBadgeEnabled = Nothing
, _cpCache = Nothing
, _cpVpcConfig = Nothing
, _cpEncryptionKey = Nothing
, _cpDescription = Nothing
, _cpServiceRole = Nothing
, _cpTags = Nothing
, _cpTimeoutInMinutes = Nothing
, _cpName = pName_
, _cpSource = pSource_
, _cpArtifacts = pArtifacts_
, _cpEnvironment = pEnvironment_
}
cpBadgeEnabled :: Lens' CreateProject (Maybe Bool)
cpBadgeEnabled = lens _cpBadgeEnabled (\ s a -> s{_cpBadgeEnabled = a})
cpCache :: Lens' CreateProject (Maybe ProjectCache)
cpCache = lens _cpCache (\ s a -> s{_cpCache = a})
cpVpcConfig :: Lens' CreateProject (Maybe VPCConfig)
cpVpcConfig = lens _cpVpcConfig (\ s a -> s{_cpVpcConfig = a})
cpEncryptionKey :: Lens' CreateProject (Maybe Text)
cpEncryptionKey = lens _cpEncryptionKey (\ s a -> s{_cpEncryptionKey = a})
cpDescription :: Lens' CreateProject (Maybe Text)
cpDescription = lens _cpDescription (\ s a -> s{_cpDescription = a})
cpServiceRole :: Lens' CreateProject (Maybe Text)
cpServiceRole = lens _cpServiceRole (\ s a -> s{_cpServiceRole = a})
cpTags :: Lens' CreateProject [Tag]
cpTags = lens _cpTags (\ s a -> s{_cpTags = a}) . _Default . _Coerce
cpTimeoutInMinutes :: Lens' CreateProject (Maybe Natural)
cpTimeoutInMinutes = lens _cpTimeoutInMinutes (\ s a -> s{_cpTimeoutInMinutes = a}) . mapping _Nat
cpName :: Lens' CreateProject Text
cpName = lens _cpName (\ s a -> s{_cpName = a})
cpSource :: Lens' CreateProject ProjectSource
cpSource = lens _cpSource (\ s a -> s{_cpSource = a})
cpArtifacts :: Lens' CreateProject ProjectArtifacts
cpArtifacts = lens _cpArtifacts (\ s a -> s{_cpArtifacts = a})
cpEnvironment :: Lens' CreateProject ProjectEnvironment
cpEnvironment = lens _cpEnvironment (\ s a -> s{_cpEnvironment = a})
instance AWSRequest CreateProject where
type Rs CreateProject = CreateProjectResponse
request = postJSON codeBuild
response
= receiveJSON
(\ s h x ->
CreateProjectResponse' <$>
(x .?> "project") <*> (pure (fromEnum s)))
instance Hashable CreateProject where
instance NFData CreateProject where
instance ToHeaders CreateProject where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeBuild_20161006.CreateProject" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateProject where
toJSON CreateProject'{..}
= object
(catMaybes
[("badgeEnabled" .=) <$> _cpBadgeEnabled,
("cache" .=) <$> _cpCache,
("vpcConfig" .=) <$> _cpVpcConfig,
("encryptionKey" .=) <$> _cpEncryptionKey,
("description" .=) <$> _cpDescription,
("serviceRole" .=) <$> _cpServiceRole,
("tags" .=) <$> _cpTags,
("timeoutInMinutes" .=) <$> _cpTimeoutInMinutes,
Just ("name" .= _cpName),
Just ("source" .= _cpSource),
Just ("artifacts" .= _cpArtifacts),
Just ("environment" .= _cpEnvironment)])
instance ToPath CreateProject where
toPath = const "/"
instance ToQuery CreateProject where
toQuery = const mempty
data CreateProjectResponse = CreateProjectResponse'
{ _cprsProject :: !(Maybe Project)
, _cprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createProjectResponse
:: Int
-> CreateProjectResponse
createProjectResponse pResponseStatus_ =
CreateProjectResponse'
{_cprsProject = Nothing, _cprsResponseStatus = pResponseStatus_}
cprsProject :: Lens' CreateProjectResponse (Maybe Project)
cprsProject = lens _cprsProject (\ s a -> s{_cprsProject = a})
cprsResponseStatus :: Lens' CreateProjectResponse Int
cprsResponseStatus = lens _cprsResponseStatus (\ s a -> s{_cprsResponseStatus = a})
instance NFData CreateProjectResponse where