module Network.AWS.CloudHSM.DescribeHAPG
    (
    
      describeHAPG
    , DescribeHAPG
    
    , dhapgHAPGARN
    
    , describeHAPGResponse
    , DescribeHAPGResponse
    
    , dhapgrsState
    , dhapgrsLastModifiedTimestamp
    , dhapgrsHSMsPendingRegistration
    , dhapgrsHSMsPendingDeletion
    , dhapgrsHAPGSerial
    , dhapgrsHSMsLastActionFailed
    , dhapgrsPartitionSerialList
    , dhapgrsHAPGARN
    , dhapgrsLabel
    , dhapgrsResponseStatus
    ) where
import Network.AWS.CloudHSM.Types
import Network.AWS.CloudHSM.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype DescribeHAPG = DescribeHAPG'
  { _dhapgHAPGARN :: Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
describeHAPG
    :: Text 
    -> DescribeHAPG
describeHAPG pHAPGARN_ = DescribeHAPG' {_dhapgHAPGARN = pHAPGARN_}
dhapgHAPGARN :: Lens' DescribeHAPG Text
dhapgHAPGARN = lens _dhapgHAPGARN (\ s a -> s{_dhapgHAPGARN = a});
instance AWSRequest DescribeHAPG where
        type Rs DescribeHAPG = DescribeHAPGResponse
        request = postJSON cloudHSM
        response
          = receiveJSON
              (\ s h x ->
                 DescribeHAPGResponse' <$>
                   (x .?> "State") <*> (x .?> "LastModifiedTimestamp")
                     <*> (x .?> "HsmsPendingRegistration" .!@ mempty)
                     <*> (x .?> "HsmsPendingDeletion" .!@ mempty)
                     <*> (x .?> "HapgSerial")
                     <*> (x .?> "HsmsLastActionFailed" .!@ mempty)
                     <*> (x .?> "PartitionSerialList" .!@ mempty)
                     <*> (x .?> "HapgArn")
                     <*> (x .?> "Label")
                     <*> (pure (fromEnum s)))
instance Hashable DescribeHAPG where
instance NFData DescribeHAPG where
instance ToHeaders DescribeHAPG where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("CloudHsmFrontendService.DescribeHapg" ::
                       ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeHAPG where
        toJSON DescribeHAPG'{..}
          = object
              (catMaybes [Just ("HapgArn" .= _dhapgHAPGARN)])
instance ToPath DescribeHAPG where
        toPath = const "/"
instance ToQuery DescribeHAPG where
        toQuery = const mempty
data DescribeHAPGResponse = DescribeHAPGResponse'
  { _dhapgrsState                   :: !(Maybe CloudHSMObjectState)
  , _dhapgrsLastModifiedTimestamp   :: !(Maybe Text)
  , _dhapgrsHSMsPendingRegistration :: !(Maybe [Text])
  , _dhapgrsHSMsPendingDeletion     :: !(Maybe [Text])
  , _dhapgrsHAPGSerial              :: !(Maybe Text)
  , _dhapgrsHSMsLastActionFailed    :: !(Maybe [Text])
  , _dhapgrsPartitionSerialList     :: !(Maybe [Text])
  , _dhapgrsHAPGARN                 :: !(Maybe Text)
  , _dhapgrsLabel                   :: !(Maybe Text)
  , _dhapgrsResponseStatus          :: !Int
  } deriving (Eq, Read, Show, Data, Typeable, Generic)
describeHAPGResponse
    :: Int 
    -> DescribeHAPGResponse
describeHAPGResponse pResponseStatus_ =
  DescribeHAPGResponse'
  { _dhapgrsState = Nothing
  , _dhapgrsLastModifiedTimestamp = Nothing
  , _dhapgrsHSMsPendingRegistration = Nothing
  , _dhapgrsHSMsPendingDeletion = Nothing
  , _dhapgrsHAPGSerial = Nothing
  , _dhapgrsHSMsLastActionFailed = Nothing
  , _dhapgrsPartitionSerialList = Nothing
  , _dhapgrsHAPGARN = Nothing
  , _dhapgrsLabel = Nothing
  , _dhapgrsResponseStatus = pResponseStatus_
  }
dhapgrsState :: Lens' DescribeHAPGResponse (Maybe CloudHSMObjectState)
dhapgrsState = lens _dhapgrsState (\ s a -> s{_dhapgrsState = a});
dhapgrsLastModifiedTimestamp :: Lens' DescribeHAPGResponse (Maybe Text)
dhapgrsLastModifiedTimestamp = lens _dhapgrsLastModifiedTimestamp (\ s a -> s{_dhapgrsLastModifiedTimestamp = a});
dhapgrsHSMsPendingRegistration :: Lens' DescribeHAPGResponse [Text]
dhapgrsHSMsPendingRegistration = lens _dhapgrsHSMsPendingRegistration (\ s a -> s{_dhapgrsHSMsPendingRegistration = a}) . _Default . _Coerce;
dhapgrsHSMsPendingDeletion :: Lens' DescribeHAPGResponse [Text]
dhapgrsHSMsPendingDeletion = lens _dhapgrsHSMsPendingDeletion (\ s a -> s{_dhapgrsHSMsPendingDeletion = a}) . _Default . _Coerce;
dhapgrsHAPGSerial :: Lens' DescribeHAPGResponse (Maybe Text)
dhapgrsHAPGSerial = lens _dhapgrsHAPGSerial (\ s a -> s{_dhapgrsHAPGSerial = a});
dhapgrsHSMsLastActionFailed :: Lens' DescribeHAPGResponse [Text]
dhapgrsHSMsLastActionFailed = lens _dhapgrsHSMsLastActionFailed (\ s a -> s{_dhapgrsHSMsLastActionFailed = a}) . _Default . _Coerce;
dhapgrsPartitionSerialList :: Lens' DescribeHAPGResponse [Text]
dhapgrsPartitionSerialList = lens _dhapgrsPartitionSerialList (\ s a -> s{_dhapgrsPartitionSerialList = a}) . _Default . _Coerce;
dhapgrsHAPGARN :: Lens' DescribeHAPGResponse (Maybe Text)
dhapgrsHAPGARN = lens _dhapgrsHAPGARN (\ s a -> s{_dhapgrsHAPGARN = a});
dhapgrsLabel :: Lens' DescribeHAPGResponse (Maybe Text)
dhapgrsLabel = lens _dhapgrsLabel (\ s a -> s{_dhapgrsLabel = a});
dhapgrsResponseStatus :: Lens' DescribeHAPGResponse Int
dhapgrsResponseStatus = lens _dhapgrsResponseStatus (\ s a -> s{_dhapgrsResponseStatus = a});
instance NFData DescribeHAPGResponse where