{-# 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.CloudHSMv2.DeleteCluster -- Copyright : (c) 2013-2018 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Deletes the specified AWS CloudHSM cluster. Before you can delete a cluster, you must delete all HSMs in the cluster. To see if the cluster contains any HSMs, use 'DescribeClusters' . To delete an HSM, use 'DeleteHsm' . -- -- module Network.AWS.CloudHSMv2.DeleteCluster ( -- * Creating a Request deleteCluster , DeleteCluster -- * Request Lenses , dcClusterId -- * Destructuring the Response , deleteClusterResponse , DeleteClusterResponse -- * Response Lenses , drsCluster , drsResponseStatus ) where import Network.AWS.CloudHSMv2.Types import Network.AWS.CloudHSMv2.Types.Product import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response -- | /See:/ 'deleteCluster' smart constructor. newtype DeleteCluster = DeleteCluster' { _dcClusterId :: Text } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'DeleteCluster' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'dcClusterId' - The identifier (ID) of the cluster that you are deleting. To find the cluster ID, use 'DescribeClusters' . deleteCluster :: Text -- ^ 'dcClusterId' -> DeleteCluster deleteCluster pClusterId_ = DeleteCluster' {_dcClusterId = pClusterId_} -- | The identifier (ID) of the cluster that you are deleting. To find the cluster ID, use 'DescribeClusters' . dcClusterId :: Lens' DeleteCluster Text dcClusterId = lens _dcClusterId (\ s a -> s{_dcClusterId = a}) instance AWSRequest DeleteCluster where type Rs DeleteCluster = DeleteClusterResponse request = postJSON cloudHSMv2 response = receiveJSON (\ s h x -> DeleteClusterResponse' <$> (x .?> "Cluster") <*> (pure (fromEnum s))) instance Hashable DeleteCluster where instance NFData DeleteCluster where instance ToHeaders DeleteCluster where toHeaders = const (mconcat ["X-Amz-Target" =# ("BaldrApiService.DeleteCluster" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON DeleteCluster where toJSON DeleteCluster'{..} = object (catMaybes [Just ("ClusterId" .= _dcClusterId)]) instance ToPath DeleteCluster where toPath = const "/" instance ToQuery DeleteCluster where toQuery = const mempty -- | /See:/ 'deleteClusterResponse' smart constructor. data DeleteClusterResponse = DeleteClusterResponse' { _drsCluster :: !(Maybe Cluster) , _drsResponseStatus :: !Int } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'DeleteClusterResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'drsCluster' - Information about the cluster that was deleted. -- -- * 'drsResponseStatus' - -- | The response status code. deleteClusterResponse :: Int -- ^ 'drsResponseStatus' -> DeleteClusterResponse deleteClusterResponse pResponseStatus_ = DeleteClusterResponse' {_drsCluster = Nothing, _drsResponseStatus = pResponseStatus_} -- | Information about the cluster that was deleted. drsCluster :: Lens' DeleteClusterResponse (Maybe Cluster) drsCluster = lens _drsCluster (\ s a -> s{_drsCluster = a}) -- | -- | The response status code. drsResponseStatus :: Lens' DeleteClusterResponse Int drsResponseStatus = lens _drsResponseStatus (\ s a -> s{_drsResponseStatus = a}) instance NFData DeleteClusterResponse where