module Network.AWS.ServiceCatalog.CreatePortfolio
    (
    
      createPortfolio
    , CreatePortfolio
    
    , creAcceptLanguage
    , creDescription
    , creTags
    , creDisplayName
    , creProviderName
    , creIdempotencyToken
    
    , createPortfolioResponse
    , CreatePortfolioResponse
    
    , crsPortfolioDetail
    , crsTags
    , crsResponseStatus
    ) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.ServiceCatalog.Types
import Network.AWS.ServiceCatalog.Types.Product
data CreatePortfolio = CreatePortfolio'
  { _creAcceptLanguage   :: !(Maybe Text)
  , _creDescription      :: !(Maybe Text)
  , _creTags             :: !(Maybe [Tag])
  , _creDisplayName      :: !Text
  , _creProviderName     :: !Text
  , _creIdempotencyToken :: !Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
createPortfolio
    :: Text 
    -> Text 
    -> Text 
    -> CreatePortfolio
createPortfolio pDisplayName_ pProviderName_ pIdempotencyToken_ =
  CreatePortfolio'
  { _creAcceptLanguage = Nothing
  , _creDescription = Nothing
  , _creTags = Nothing
  , _creDisplayName = pDisplayName_
  , _creProviderName = pProviderName_
  , _creIdempotencyToken = pIdempotencyToken_
  }
creAcceptLanguage :: Lens' CreatePortfolio (Maybe Text)
creAcceptLanguage = lens _creAcceptLanguage (\ s a -> s{_creAcceptLanguage = a});
creDescription :: Lens' CreatePortfolio (Maybe Text)
creDescription = lens _creDescription (\ s a -> s{_creDescription = a});
creTags :: Lens' CreatePortfolio [Tag]
creTags = lens _creTags (\ s a -> s{_creTags = a}) . _Default . _Coerce;
creDisplayName :: Lens' CreatePortfolio Text
creDisplayName = lens _creDisplayName (\ s a -> s{_creDisplayName = a});
creProviderName :: Lens' CreatePortfolio Text
creProviderName = lens _creProviderName (\ s a -> s{_creProviderName = a});
creIdempotencyToken :: Lens' CreatePortfolio Text
creIdempotencyToken = lens _creIdempotencyToken (\ s a -> s{_creIdempotencyToken = a});
instance AWSRequest CreatePortfolio where
        type Rs CreatePortfolio = CreatePortfolioResponse
        request = postJSON serviceCatalog
        response
          = receiveJSON
              (\ s h x ->
                 CreatePortfolioResponse' <$>
                   (x .?> "PortfolioDetail") <*>
                     (x .?> "Tags" .!@ mempty)
                     <*> (pure (fromEnum s)))
instance Hashable CreatePortfolio where
instance NFData CreatePortfolio where
instance ToHeaders CreatePortfolio where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("AWS242ServiceCatalogService.CreatePortfolio" ::
                       ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreatePortfolio where
        toJSON CreatePortfolio'{..}
          = object
              (catMaybes
                 [("AcceptLanguage" .=) <$> _creAcceptLanguage,
                  ("Description" .=) <$> _creDescription,
                  ("Tags" .=) <$> _creTags,
                  Just ("DisplayName" .= _creDisplayName),
                  Just ("ProviderName" .= _creProviderName),
                  Just ("IdempotencyToken" .= _creIdempotencyToken)])
instance ToPath CreatePortfolio where
        toPath = const "/"
instance ToQuery CreatePortfolio where
        toQuery = const mempty
data CreatePortfolioResponse = CreatePortfolioResponse'
  { _crsPortfolioDetail :: !(Maybe PortfolioDetail)
  , _crsTags            :: !(Maybe [Tag])
  , _crsResponseStatus  :: !Int
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
createPortfolioResponse
    :: Int 
    -> CreatePortfolioResponse
createPortfolioResponse pResponseStatus_ =
  CreatePortfolioResponse'
  { _crsPortfolioDetail = Nothing
  , _crsTags = Nothing
  , _crsResponseStatus = pResponseStatus_
  }
crsPortfolioDetail :: Lens' CreatePortfolioResponse (Maybe PortfolioDetail)
crsPortfolioDetail = lens _crsPortfolioDetail (\ s a -> s{_crsPortfolioDetail = a});
crsTags :: Lens' CreatePortfolioResponse [Tag]
crsTags = lens _crsTags (\ s a -> s{_crsTags = a}) . _Default . _Coerce;
crsResponseStatus :: Lens' CreatePortfolioResponse Int
crsResponseStatus = lens _crsResponseStatus (\ s a -> s{_crsResponseStatus = a});
instance NFData CreatePortfolioResponse where