module Network.AWS.StorageGateway.UpdateChapCredentials
    (
    
      updateChapCredentials
    , UpdateChapCredentials
    
    , uccSecretToAuthenticateTarget
    , uccTargetARN
    , uccSecretToAuthenticateInitiator
    , uccInitiatorName
    
    , updateChapCredentialsResponse
    , UpdateChapCredentialsResponse
    
    , uccrsTargetARN
    , uccrsInitiatorName
    , uccrsStatus
    ) where
import           Network.AWS.Prelude
import           Network.AWS.Request
import           Network.AWS.Response
import           Network.AWS.StorageGateway.Types
import           Network.AWS.StorageGateway.Types.Product
data UpdateChapCredentials = UpdateChapCredentials'
    { _uccSecretToAuthenticateTarget    :: !(Maybe Text)
    , _uccTargetARN                     :: !Text
    , _uccSecretToAuthenticateInitiator :: !Text
    , _uccInitiatorName                 :: !Text
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
updateChapCredentials
    :: Text 
    -> Text 
    -> Text 
    -> UpdateChapCredentials
updateChapCredentials pTargetARN_ pSecretToAuthenticateInitiator_ pInitiatorName_ =
    UpdateChapCredentials'
    { _uccSecretToAuthenticateTarget = Nothing
    , _uccTargetARN = pTargetARN_
    , _uccSecretToAuthenticateInitiator = pSecretToAuthenticateInitiator_
    , _uccInitiatorName = pInitiatorName_
    }
uccSecretToAuthenticateTarget :: Lens' UpdateChapCredentials (Maybe Text)
uccSecretToAuthenticateTarget = lens _uccSecretToAuthenticateTarget (\ s a -> s{_uccSecretToAuthenticateTarget = a});
uccTargetARN :: Lens' UpdateChapCredentials Text
uccTargetARN = lens _uccTargetARN (\ s a -> s{_uccTargetARN = a});
uccSecretToAuthenticateInitiator :: Lens' UpdateChapCredentials Text
uccSecretToAuthenticateInitiator = lens _uccSecretToAuthenticateInitiator (\ s a -> s{_uccSecretToAuthenticateInitiator = a});
uccInitiatorName :: Lens' UpdateChapCredentials Text
uccInitiatorName = lens _uccInitiatorName (\ s a -> s{_uccInitiatorName = a});
instance AWSRequest UpdateChapCredentials where
        type Rs UpdateChapCredentials =
             UpdateChapCredentialsResponse
        request = postJSON storageGateway
        response
          = receiveJSON
              (\ s h x ->
                 UpdateChapCredentialsResponse' <$>
                   (x .?> "TargetARN") <*> (x .?> "InitiatorName") <*>
                     (pure (fromEnum s)))
instance ToHeaders UpdateChapCredentials where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("StorageGateway_20130630.UpdateChapCredentials" ::
                       ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateChapCredentials where
        toJSON UpdateChapCredentials'{..}
          = object
              (catMaybes
                 [("SecretToAuthenticateTarget" .=) <$>
                    _uccSecretToAuthenticateTarget,
                  Just ("TargetARN" .= _uccTargetARN),
                  Just
                    ("SecretToAuthenticateInitiator" .=
                       _uccSecretToAuthenticateInitiator),
                  Just ("InitiatorName" .= _uccInitiatorName)])
instance ToPath UpdateChapCredentials where
        toPath = const "/"
instance ToQuery UpdateChapCredentials where
        toQuery = const mempty
data UpdateChapCredentialsResponse = UpdateChapCredentialsResponse'
    { _uccrsTargetARN     :: !(Maybe Text)
    , _uccrsInitiatorName :: !(Maybe Text)
    , _uccrsStatus        :: !Int
    } deriving (Eq,Read,Show,Data,Typeable,Generic)
updateChapCredentialsResponse
    :: Int 
    -> UpdateChapCredentialsResponse
updateChapCredentialsResponse pStatus_ =
    UpdateChapCredentialsResponse'
    { _uccrsTargetARN = Nothing
    , _uccrsInitiatorName = Nothing
    , _uccrsStatus = pStatus_
    }
uccrsTargetARN :: Lens' UpdateChapCredentialsResponse (Maybe Text)
uccrsTargetARN = lens _uccrsTargetARN (\ s a -> s{_uccrsTargetARN = a});
uccrsInitiatorName :: Lens' UpdateChapCredentialsResponse (Maybe Text)
uccrsInitiatorName = lens _uccrsInitiatorName (\ s a -> s{_uccrsInitiatorName = a});
uccrsStatus :: Lens' UpdateChapCredentialsResponse Int
uccrsStatus = lens _uccrsStatus (\ s a -> s{_uccrsStatus = a});