module Network.AWS.ServiceCatalog.UpdateProduct
    (
    
      updateProduct
    , UpdateProduct
    
    , upRemoveTags
    , upOwner
    , upSupportURL
    , upDistributor
    , upName
    , upAcceptLanguage
    , upAddTags
    , upSupportEmail
    , upDescription
    , upSupportDescription
    , upId
    
    , updateProductResponse
    , UpdateProductResponse
    
    , ursProductViewDetail
    , ursTags
    , ursResponseStatus
    ) 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 UpdateProduct = UpdateProduct'
  { _upRemoveTags         :: !(Maybe [Text])
  , _upOwner              :: !(Maybe Text)
  , _upSupportURL         :: !(Maybe Text)
  , _upDistributor        :: !(Maybe Text)
  , _upName               :: !(Maybe Text)
  , _upAcceptLanguage     :: !(Maybe Text)
  , _upAddTags            :: !(Maybe [Tag])
  , _upSupportEmail       :: !(Maybe Text)
  , _upDescription        :: !(Maybe Text)
  , _upSupportDescription :: !(Maybe Text)
  , _upId                 :: !Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
updateProduct
    :: Text 
    -> UpdateProduct
updateProduct pId_ =
  UpdateProduct'
  { _upRemoveTags = Nothing
  , _upOwner = Nothing
  , _upSupportURL = Nothing
  , _upDistributor = Nothing
  , _upName = Nothing
  , _upAcceptLanguage = Nothing
  , _upAddTags = Nothing
  , _upSupportEmail = Nothing
  , _upDescription = Nothing
  , _upSupportDescription = Nothing
  , _upId = pId_
  }
upRemoveTags :: Lens' UpdateProduct [Text]
upRemoveTags = lens _upRemoveTags (\ s a -> s{_upRemoveTags = a}) . _Default . _Coerce;
upOwner :: Lens' UpdateProduct (Maybe Text)
upOwner = lens _upOwner (\ s a -> s{_upOwner = a});
upSupportURL :: Lens' UpdateProduct (Maybe Text)
upSupportURL = lens _upSupportURL (\ s a -> s{_upSupportURL = a});
upDistributor :: Lens' UpdateProduct (Maybe Text)
upDistributor = lens _upDistributor (\ s a -> s{_upDistributor = a});
upName :: Lens' UpdateProduct (Maybe Text)
upName = lens _upName (\ s a -> s{_upName = a});
upAcceptLanguage :: Lens' UpdateProduct (Maybe Text)
upAcceptLanguage = lens _upAcceptLanguage (\ s a -> s{_upAcceptLanguage = a});
upAddTags :: Lens' UpdateProduct [Tag]
upAddTags = lens _upAddTags (\ s a -> s{_upAddTags = a}) . _Default . _Coerce;
upSupportEmail :: Lens' UpdateProduct (Maybe Text)
upSupportEmail = lens _upSupportEmail (\ s a -> s{_upSupportEmail = a});
upDescription :: Lens' UpdateProduct (Maybe Text)
upDescription = lens _upDescription (\ s a -> s{_upDescription = a});
upSupportDescription :: Lens' UpdateProduct (Maybe Text)
upSupportDescription = lens _upSupportDescription (\ s a -> s{_upSupportDescription = a});
upId :: Lens' UpdateProduct Text
upId = lens _upId (\ s a -> s{_upId = a});
instance AWSRequest UpdateProduct where
        type Rs UpdateProduct = UpdateProductResponse
        request = postJSON serviceCatalog
        response
          = receiveJSON
              (\ s h x ->
                 UpdateProductResponse' <$>
                   (x .?> "ProductViewDetail") <*>
                     (x .?> "Tags" .!@ mempty)
                     <*> (pure (fromEnum s)))
instance Hashable UpdateProduct where
instance NFData UpdateProduct where
instance ToHeaders UpdateProduct where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("AWS242ServiceCatalogService.UpdateProduct" ::
                       ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateProduct where
        toJSON UpdateProduct'{..}
          = object
              (catMaybes
                 [("RemoveTags" .=) <$> _upRemoveTags,
                  ("Owner" .=) <$> _upOwner,
                  ("SupportUrl" .=) <$> _upSupportURL,
                  ("Distributor" .=) <$> _upDistributor,
                  ("Name" .=) <$> _upName,
                  ("AcceptLanguage" .=) <$> _upAcceptLanguage,
                  ("AddTags" .=) <$> _upAddTags,
                  ("SupportEmail" .=) <$> _upSupportEmail,
                  ("Description" .=) <$> _upDescription,
                  ("SupportDescription" .=) <$> _upSupportDescription,
                  Just ("Id" .= _upId)])
instance ToPath UpdateProduct where
        toPath = const "/"
instance ToQuery UpdateProduct where
        toQuery = const mempty
data UpdateProductResponse = UpdateProductResponse'
  { _ursProductViewDetail :: !(Maybe ProductViewDetail)
  , _ursTags              :: !(Maybe [Tag])
  , _ursResponseStatus    :: !Int
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
updateProductResponse
    :: Int 
    -> UpdateProductResponse
updateProductResponse pResponseStatus_ =
  UpdateProductResponse'
  { _ursProductViewDetail = Nothing
  , _ursTags = Nothing
  , _ursResponseStatus = pResponseStatus_
  }
ursProductViewDetail :: Lens' UpdateProductResponse (Maybe ProductViewDetail)
ursProductViewDetail = lens _ursProductViewDetail (\ s a -> s{_ursProductViewDetail = a});
ursTags :: Lens' UpdateProductResponse [Tag]
ursTags = lens _ursTags (\ s a -> s{_ursTags = a}) . _Default . _Coerce;
ursResponseStatus :: Lens' UpdateProductResponse Int
ursResponseStatus = lens _ursResponseStatus (\ s a -> s{_ursResponseStatus = a});
instance NFData UpdateProductResponse where