{-# 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.KMS.DisableKey
-- Copyright   : (c) 2013-2016 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Sets the state of a customer master key (CMK) to disabled, thereby preventing its use for cryptographic operations. For more information about how key state affects the use of a CMK, see <http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html How Key State Affects the Use of a Customer Master Key> in the /AWS Key Management Service Developer Guide/ .
--
--
module Network.AWS.KMS.DisableKey
    (
    -- * Creating a Request
      disableKey
    , DisableKey
    -- * Request Lenses
    , dkKeyId

    -- * Destructuring the Response
    , disableKeyResponse
    , DisableKeyResponse
    ) where

import           Network.AWS.KMS.Types
import           Network.AWS.KMS.Types.Product
import           Network.AWS.Lens
import           Network.AWS.Prelude
import           Network.AWS.Request
import           Network.AWS.Response

-- | /See:/ 'disableKey' smart constructor.
newtype DisableKey = DisableKey'
    { _dkKeyId :: Text
    } deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'DisableKey' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dkKeyId' - A unique identifier for the CMK. Use the CMK's unique identifier or its Amazon Resource Name (ARN). For example:     * Unique ID: 1234abcd-12ab-34cd-56ef-1234567890ab     * ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
disableKey
    :: Text -- ^ 'dkKeyId'
    -> DisableKey
disableKey pKeyId_ =
    DisableKey'
    { _dkKeyId = pKeyId_
    }

-- | A unique identifier for the CMK. Use the CMK's unique identifier or its Amazon Resource Name (ARN). For example:     * Unique ID: 1234abcd-12ab-34cd-56ef-1234567890ab     * ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
dkKeyId :: Lens' DisableKey Text
dkKeyId = lens _dkKeyId (\ s a -> s{_dkKeyId = a});

instance AWSRequest DisableKey where
        type Rs DisableKey = DisableKeyResponse
        request = postJSON kms
        response = receiveNull DisableKeyResponse'

instance Hashable DisableKey

instance NFData DisableKey

instance ToHeaders DisableKey where
        toHeaders
          = const
              (mconcat
                 ["X-Amz-Target" =#
                    ("TrentService.DisableKey" :: ByteString),
                  "Content-Type" =#
                    ("application/x-amz-json-1.1" :: ByteString)])

instance ToJSON DisableKey where
        toJSON DisableKey'{..}
          = object (catMaybes [Just ("KeyId" .= _dkKeyId)])

instance ToPath DisableKey where
        toPath = const "/"

instance ToQuery DisableKey where
        toQuery = const mempty

-- | /See:/ 'disableKeyResponse' smart constructor.
data DisableKeyResponse =
    DisableKeyResponse'
    deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'DisableKeyResponse' with the minimum fields required to make a request.
--
disableKeyResponse
    :: DisableKeyResponse
disableKeyResponse = DisableKeyResponse'

instance NFData DisableKeyResponse