{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.CodeBuild.CreateProject -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates a build project. -- -- module Network.AWS.CodeBuild.CreateProject ( -- * Creating a Request createProject , CreateProject -- * Request Lenses , cpEncryptionKey , cpDescription , cpServiceRole , cpTags , cpTimeoutInMinutes , cpName , cpSource , cpArtifacts , cpEnvironment -- * Destructuring the Response , createProjectResponse , CreateProjectResponse -- * Response Lenses , 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 -- | /See:/ 'createProject' smart constructor. data CreateProject = CreateProject' { _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) -- | Creates a value of 'CreateProject' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cpEncryptionKey' - The AWS Key Management Service (AWS KMS) customer master key (CMK) to be used for encrypting the build project's build output artifacts. You can specify either the CMK's Amazon Resource Name (ARN) or, if available, the CMK's alias (using the format @alias//alias-name/ @ ). -- -- * 'cpDescription' - A meaningful description of the build project. -- -- * 'cpServiceRole' - The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that enables AWS CodeBuild to interact with dependent AWS services on behalf of the AWS account. -- -- * 'cpTags' - A set of tags for this build project. These tags are available for use by AWS services that support AWS CodeBuild build project tags. -- -- * 'cpTimeoutInMinutes' - How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. The default is 60 minutes. -- -- * 'cpName' - The build project's name. -- -- * 'cpSource' - Information about the build project's build input source code. -- -- * 'cpArtifacts' - Information about the build project's build output artifacts. -- -- * 'cpEnvironment' - Information about the build project's build environment. createProject :: Text -- ^ 'cpName' -> ProjectSource -- ^ 'cpSource' -> ProjectArtifacts -- ^ 'cpArtifacts' -> ProjectEnvironment -- ^ 'cpEnvironment' -> CreateProject createProject pName_ pSource_ pArtifacts_ pEnvironment_ = CreateProject' { _cpEncryptionKey = Nothing , _cpDescription = Nothing , _cpServiceRole = Nothing , _cpTags = Nothing , _cpTimeoutInMinutes = Nothing , _cpName = pName_ , _cpSource = pSource_ , _cpArtifacts = pArtifacts_ , _cpEnvironment = pEnvironment_ } -- | The AWS Key Management Service (AWS KMS) customer master key (CMK) to be used for encrypting the build project's build output artifacts. You can specify either the CMK's Amazon Resource Name (ARN) or, if available, the CMK's alias (using the format @alias//alias-name/ @ ). cpEncryptionKey :: Lens' CreateProject (Maybe Text) cpEncryptionKey = lens _cpEncryptionKey (\ s a -> s{_cpEncryptionKey = a}); -- | A meaningful description of the build project. cpDescription :: Lens' CreateProject (Maybe Text) cpDescription = lens _cpDescription (\ s a -> s{_cpDescription = a}); -- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that enables AWS CodeBuild to interact with dependent AWS services on behalf of the AWS account. cpServiceRole :: Lens' CreateProject (Maybe Text) cpServiceRole = lens _cpServiceRole (\ s a -> s{_cpServiceRole = a}); -- | A set of tags for this build project. These tags are available for use by AWS services that support AWS CodeBuild build project tags. cpTags :: Lens' CreateProject [Tag] cpTags = lens _cpTags (\ s a -> s{_cpTags = a}) . _Default . _Coerce; -- | How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. The default is 60 minutes. cpTimeoutInMinutes :: Lens' CreateProject (Maybe Natural) cpTimeoutInMinutes = lens _cpTimeoutInMinutes (\ s a -> s{_cpTimeoutInMinutes = a}) . mapping _Nat; -- | The build project's name. cpName :: Lens' CreateProject Text cpName = lens _cpName (\ s a -> s{_cpName = a}); -- | Information about the build project's build input source code. cpSource :: Lens' CreateProject ProjectSource cpSource = lens _cpSource (\ s a -> s{_cpSource = a}); -- | Information about the build project's build output artifacts. cpArtifacts :: Lens' CreateProject ProjectArtifacts cpArtifacts = lens _cpArtifacts (\ s a -> s{_cpArtifacts = a}); -- | Information about the build project's build environment. 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 instance NFData CreateProject 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 [("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 -- | /See:/ 'createProjectResponse' smart constructor. data CreateProjectResponse = CreateProjectResponse' { _cprsProject :: !(Maybe Project) , _cprsResponseStatus :: !Int } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'CreateProjectResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cprsProject' - Information about the build project that was created. -- -- * 'cprsResponseStatus' - -- | The response status code. createProjectResponse :: Int -- ^ 'cprsResponseStatus' -> CreateProjectResponse createProjectResponse pResponseStatus_ = CreateProjectResponse' { _cprsProject = Nothing , _cprsResponseStatus = pResponseStatus_ } -- | Information about the build project that was created. cprsProject :: Lens' CreateProjectResponse (Maybe Project) cprsProject = lens _cprsProject (\ s a -> s{_cprsProject = a}); -- | -- | The response status code. cprsResponseStatus :: Lens' CreateProjectResponse Int cprsResponseStatus = lens _cprsResponseStatus (\ s a -> s{_cprsResponseStatus = a}); instance NFData CreateProjectResponse