{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}
module Aws.Iam.Commands.DeleteAccessKey
    ( DeleteAccessKey(..)
    , DeleteAccessKeyResponse(..)
    ) where

import           Aws.Core
import           Aws.Iam.Core
import           Aws.Iam.Internal
import           Control.Applicative
import           Data.Text           (Text)
import           Data.Typeable
import           Prelude

-- | Deletes the access key associated with the specified user.
--
-- <http://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteAccessKey.html>
data DeleteAccessKey
    = DeleteAccessKey {
        DeleteAccessKey -> Text
dakAccessKeyId :: Text
      -- ^ ID of the access key to be deleted.
      , DeleteAccessKey -> Maybe Text
dakUserName    :: Maybe Text
      -- ^ User name with which the access key is associated.
      }
    deriving (DeleteAccessKey -> DeleteAccessKey -> Bool
(DeleteAccessKey -> DeleteAccessKey -> Bool)
-> (DeleteAccessKey -> DeleteAccessKey -> Bool)
-> Eq DeleteAccessKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteAccessKey -> DeleteAccessKey -> Bool
== :: DeleteAccessKey -> DeleteAccessKey -> Bool
$c/= :: DeleteAccessKey -> DeleteAccessKey -> Bool
/= :: DeleteAccessKey -> DeleteAccessKey -> Bool
Eq, Eq DeleteAccessKey
Eq DeleteAccessKey =>
(DeleteAccessKey -> DeleteAccessKey -> Ordering)
-> (DeleteAccessKey -> DeleteAccessKey -> Bool)
-> (DeleteAccessKey -> DeleteAccessKey -> Bool)
-> (DeleteAccessKey -> DeleteAccessKey -> Bool)
-> (DeleteAccessKey -> DeleteAccessKey -> Bool)
-> (DeleteAccessKey -> DeleteAccessKey -> DeleteAccessKey)
-> (DeleteAccessKey -> DeleteAccessKey -> DeleteAccessKey)
-> Ord DeleteAccessKey
DeleteAccessKey -> DeleteAccessKey -> Bool
DeleteAccessKey -> DeleteAccessKey -> Ordering
DeleteAccessKey -> DeleteAccessKey -> DeleteAccessKey
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DeleteAccessKey -> DeleteAccessKey -> Ordering
compare :: DeleteAccessKey -> DeleteAccessKey -> Ordering
$c< :: DeleteAccessKey -> DeleteAccessKey -> Bool
< :: DeleteAccessKey -> DeleteAccessKey -> Bool
$c<= :: DeleteAccessKey -> DeleteAccessKey -> Bool
<= :: DeleteAccessKey -> DeleteAccessKey -> Bool
$c> :: DeleteAccessKey -> DeleteAccessKey -> Bool
> :: DeleteAccessKey -> DeleteAccessKey -> Bool
$c>= :: DeleteAccessKey -> DeleteAccessKey -> Bool
>= :: DeleteAccessKey -> DeleteAccessKey -> Bool
$cmax :: DeleteAccessKey -> DeleteAccessKey -> DeleteAccessKey
max :: DeleteAccessKey -> DeleteAccessKey -> DeleteAccessKey
$cmin :: DeleteAccessKey -> DeleteAccessKey -> DeleteAccessKey
min :: DeleteAccessKey -> DeleteAccessKey -> DeleteAccessKey
Ord, Int -> DeleteAccessKey -> ShowS
[DeleteAccessKey] -> ShowS
DeleteAccessKey -> String
(Int -> DeleteAccessKey -> ShowS)
-> (DeleteAccessKey -> String)
-> ([DeleteAccessKey] -> ShowS)
-> Show DeleteAccessKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteAccessKey -> ShowS
showsPrec :: Int -> DeleteAccessKey -> ShowS
$cshow :: DeleteAccessKey -> String
show :: DeleteAccessKey -> String
$cshowList :: [DeleteAccessKey] -> ShowS
showList :: [DeleteAccessKey] -> ShowS
Show, Typeable)

instance SignQuery DeleteAccessKey where
    type ServiceConfiguration DeleteAccessKey = IamConfiguration
    signQuery :: forall queryType.
DeleteAccessKey
-> ServiceConfiguration DeleteAccessKey queryType
-> SignatureData
-> SignedQuery
signQuery DeleteAccessKey{Maybe Text
Text
dakAccessKeyId :: DeleteAccessKey -> Text
dakUserName :: DeleteAccessKey -> Maybe Text
dakAccessKeyId :: Text
dakUserName :: Maybe Text
..}
        = ByteString
-> [Maybe (ByteString, Text)]
-> IamConfiguration queryType
-> SignatureData
-> SignedQuery
forall qt.
ByteString
-> [Maybe (ByteString, Text)]
-> IamConfiguration qt
-> SignatureData
-> SignedQuery
iamAction' ByteString
"DeleteAccessKey" [
              (ByteString, Text) -> Maybe (ByteString, Text)
forall a. a -> Maybe a
Just (ByteString
"AccessKeyId", Text
dakAccessKeyId)
            , (ByteString
"UserName",) (Text -> (ByteString, Text))
-> Maybe Text -> Maybe (ByteString, Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
dakUserName
            ]

data DeleteAccessKeyResponse = DeleteAccessKeyResponse
    deriving (DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
(DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool)
-> (DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool)
-> Eq DeleteAccessKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
== :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
$c/= :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
/= :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
Eq, Eq DeleteAccessKeyResponse
Eq DeleteAccessKeyResponse =>
(DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Ordering)
-> (DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool)
-> (DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool)
-> (DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool)
-> (DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool)
-> (DeleteAccessKeyResponse
    -> DeleteAccessKeyResponse -> DeleteAccessKeyResponse)
-> (DeleteAccessKeyResponse
    -> DeleteAccessKeyResponse -> DeleteAccessKeyResponse)
-> Ord DeleteAccessKeyResponse
DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Ordering
DeleteAccessKeyResponse
-> DeleteAccessKeyResponse -> DeleteAccessKeyResponse
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Ordering
compare :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Ordering
$c< :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
< :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
$c<= :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
<= :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
$c> :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
> :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
$c>= :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
>= :: DeleteAccessKeyResponse -> DeleteAccessKeyResponse -> Bool
$cmax :: DeleteAccessKeyResponse
-> DeleteAccessKeyResponse -> DeleteAccessKeyResponse
max :: DeleteAccessKeyResponse
-> DeleteAccessKeyResponse -> DeleteAccessKeyResponse
$cmin :: DeleteAccessKeyResponse
-> DeleteAccessKeyResponse -> DeleteAccessKeyResponse
min :: DeleteAccessKeyResponse
-> DeleteAccessKeyResponse -> DeleteAccessKeyResponse
Ord, Int -> DeleteAccessKeyResponse -> ShowS
[DeleteAccessKeyResponse] -> ShowS
DeleteAccessKeyResponse -> String
(Int -> DeleteAccessKeyResponse -> ShowS)
-> (DeleteAccessKeyResponse -> String)
-> ([DeleteAccessKeyResponse] -> ShowS)
-> Show DeleteAccessKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteAccessKeyResponse -> ShowS
showsPrec :: Int -> DeleteAccessKeyResponse -> ShowS
$cshow :: DeleteAccessKeyResponse -> String
show :: DeleteAccessKeyResponse -> String
$cshowList :: [DeleteAccessKeyResponse] -> ShowS
showList :: [DeleteAccessKeyResponse] -> ShowS
Show, Typeable)

instance ResponseConsumer DeleteAccessKey DeleteAccessKeyResponse where
    type ResponseMetadata DeleteAccessKeyResponse = IamMetadata
    responseConsumer :: Request
-> DeleteAccessKey
-> IORef (ResponseMetadata DeleteAccessKeyResponse)
-> HTTPResponseConsumer DeleteAccessKeyResponse
responseConsumer Request
_ DeleteAccessKey
_
        = (Cursor -> Response IamMetadata DeleteAccessKeyResponse)
-> IORef IamMetadata
-> HTTPResponseConsumer DeleteAccessKeyResponse
forall a.
(Cursor -> Response IamMetadata a)
-> IORef IamMetadata -> HTTPResponseConsumer a
iamResponseConsumer (Response IamMetadata DeleteAccessKeyResponse
-> Cursor -> Response IamMetadata DeleteAccessKeyResponse
forall a b. a -> b -> a
const (Response IamMetadata DeleteAccessKeyResponse
 -> Cursor -> Response IamMetadata DeleteAccessKeyResponse)
-> Response IamMetadata DeleteAccessKeyResponse
-> Cursor
-> Response IamMetadata DeleteAccessKeyResponse
forall a b. (a -> b) -> a -> b
$ DeleteAccessKeyResponse
-> Response IamMetadata DeleteAccessKeyResponse
forall a. a -> Response IamMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return DeleteAccessKeyResponse
DeleteAccessKeyResponse)

instance Transaction DeleteAccessKey DeleteAccessKeyResponse

instance AsMemoryResponse DeleteAccessKeyResponse where
    type MemoryResponse DeleteAccessKeyResponse = DeleteAccessKeyResponse
    loadToMemory :: DeleteAccessKeyResponse
-> ResourceT IO (MemoryResponse DeleteAccessKeyResponse)
loadToMemory = DeleteAccessKeyResponse
-> ResourceT IO (MemoryResponse DeleteAccessKeyResponse)
DeleteAccessKeyResponse -> ResourceT IO DeleteAccessKeyResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return