{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Config.PutConfigurationRecorder
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new configuration recorder to record the selected resource
-- configurations.
--
-- You can use this action to change the role @roleARN@ or the
-- @recordingGroup@ of an existing recorder. To change the role, call the
-- action on the existing configuration recorder and specify a role.
--
-- Currently, you can specify only one configuration recorder per region in
-- your account.
--
-- If @ConfigurationRecorder@ does not have the __recordingGroup__
-- parameter specified, the default is to record all supported resource
-- types.
module Amazonka.Config.PutConfigurationRecorder
  ( -- * Creating a Request
    PutConfigurationRecorder (..),
    newPutConfigurationRecorder,

    -- * Request Lenses
    putConfigurationRecorder_configurationRecorder,

    -- * Destructuring the Response
    PutConfigurationRecorderResponse (..),
    newPutConfigurationRecorderResponse,
  )
where

import Amazonka.Config.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | The input for the PutConfigurationRecorder action.
--
-- /See:/ 'newPutConfigurationRecorder' smart constructor.
data PutConfigurationRecorder = PutConfigurationRecorder'
  { -- | The configuration recorder object that records each configuration change
    -- made to the resources.
    PutConfigurationRecorder -> ConfigurationRecorder
configurationRecorder :: ConfigurationRecorder
  }
  deriving (PutConfigurationRecorder -> PutConfigurationRecorder -> Bool
(PutConfigurationRecorder -> PutConfigurationRecorder -> Bool)
-> (PutConfigurationRecorder -> PutConfigurationRecorder -> Bool)
-> Eq PutConfigurationRecorder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigurationRecorder -> PutConfigurationRecorder -> Bool
$c/= :: PutConfigurationRecorder -> PutConfigurationRecorder -> Bool
== :: PutConfigurationRecorder -> PutConfigurationRecorder -> Bool
$c== :: PutConfigurationRecorder -> PutConfigurationRecorder -> Bool
Prelude.Eq, ReadPrec [PutConfigurationRecorder]
ReadPrec PutConfigurationRecorder
Int -> ReadS PutConfigurationRecorder
ReadS [PutConfigurationRecorder]
(Int -> ReadS PutConfigurationRecorder)
-> ReadS [PutConfigurationRecorder]
-> ReadPrec PutConfigurationRecorder
-> ReadPrec [PutConfigurationRecorder]
-> Read PutConfigurationRecorder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigurationRecorder]
$creadListPrec :: ReadPrec [PutConfigurationRecorder]
readPrec :: ReadPrec PutConfigurationRecorder
$creadPrec :: ReadPrec PutConfigurationRecorder
readList :: ReadS [PutConfigurationRecorder]
$creadList :: ReadS [PutConfigurationRecorder]
readsPrec :: Int -> ReadS PutConfigurationRecorder
$creadsPrec :: Int -> ReadS PutConfigurationRecorder
Prelude.Read, Int -> PutConfigurationRecorder -> ShowS
[PutConfigurationRecorder] -> ShowS
PutConfigurationRecorder -> String
(Int -> PutConfigurationRecorder -> ShowS)
-> (PutConfigurationRecorder -> String)
-> ([PutConfigurationRecorder] -> ShowS)
-> Show PutConfigurationRecorder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigurationRecorder] -> ShowS
$cshowList :: [PutConfigurationRecorder] -> ShowS
show :: PutConfigurationRecorder -> String
$cshow :: PutConfigurationRecorder -> String
showsPrec :: Int -> PutConfigurationRecorder -> ShowS
$cshowsPrec :: Int -> PutConfigurationRecorder -> ShowS
Prelude.Show, (forall x.
 PutConfigurationRecorder -> Rep PutConfigurationRecorder x)
-> (forall x.
    Rep PutConfigurationRecorder x -> PutConfigurationRecorder)
-> Generic PutConfigurationRecorder
forall x.
Rep PutConfigurationRecorder x -> PutConfigurationRecorder
forall x.
PutConfigurationRecorder -> Rep PutConfigurationRecorder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutConfigurationRecorder x -> PutConfigurationRecorder
$cfrom :: forall x.
PutConfigurationRecorder -> Rep PutConfigurationRecorder x
Prelude.Generic)

-- |
-- Create a value of 'PutConfigurationRecorder' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'configurationRecorder', 'putConfigurationRecorder_configurationRecorder' - The configuration recorder object that records each configuration change
-- made to the resources.
newPutConfigurationRecorder ::
  -- | 'configurationRecorder'
  ConfigurationRecorder ->
  PutConfigurationRecorder
newPutConfigurationRecorder :: ConfigurationRecorder -> PutConfigurationRecorder
newPutConfigurationRecorder ConfigurationRecorder
pConfigurationRecorder_ =
  PutConfigurationRecorder' :: ConfigurationRecorder -> PutConfigurationRecorder
PutConfigurationRecorder'
    { $sel:configurationRecorder:PutConfigurationRecorder' :: ConfigurationRecorder
configurationRecorder =
        ConfigurationRecorder
pConfigurationRecorder_
    }

-- | The configuration recorder object that records each configuration change
-- made to the resources.
putConfigurationRecorder_configurationRecorder :: Lens.Lens' PutConfigurationRecorder ConfigurationRecorder
putConfigurationRecorder_configurationRecorder :: (ConfigurationRecorder -> f ConfigurationRecorder)
-> PutConfigurationRecorder -> f PutConfigurationRecorder
putConfigurationRecorder_configurationRecorder = (PutConfigurationRecorder -> ConfigurationRecorder)
-> (PutConfigurationRecorder
    -> ConfigurationRecorder -> PutConfigurationRecorder)
-> Lens
     PutConfigurationRecorder
     PutConfigurationRecorder
     ConfigurationRecorder
     ConfigurationRecorder
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigurationRecorder' {ConfigurationRecorder
configurationRecorder :: ConfigurationRecorder
$sel:configurationRecorder:PutConfigurationRecorder' :: PutConfigurationRecorder -> ConfigurationRecorder
configurationRecorder} -> ConfigurationRecorder
configurationRecorder) (\s :: PutConfigurationRecorder
s@PutConfigurationRecorder' {} ConfigurationRecorder
a -> PutConfigurationRecorder
s {$sel:configurationRecorder:PutConfigurationRecorder' :: ConfigurationRecorder
configurationRecorder = ConfigurationRecorder
a} :: PutConfigurationRecorder)

instance Core.AWSRequest PutConfigurationRecorder where
  type
    AWSResponse PutConfigurationRecorder =
      PutConfigurationRecorderResponse
  request :: PutConfigurationRecorder -> Request PutConfigurationRecorder
request = Service
-> PutConfigurationRecorder -> Request PutConfigurationRecorder
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutConfigurationRecorder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutConfigurationRecorder)))
response =
    AWSResponse PutConfigurationRecorder
-> Logger
-> Service
-> Proxy PutConfigurationRecorder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutConfigurationRecorder)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse PutConfigurationRecorder
PutConfigurationRecorderResponse
PutConfigurationRecorderResponse'

instance Prelude.Hashable PutConfigurationRecorder

instance Prelude.NFData PutConfigurationRecorder

instance Core.ToHeaders PutConfigurationRecorder where
  toHeaders :: PutConfigurationRecorder -> [Header]
toHeaders =
    [Header] -> PutConfigurationRecorder -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"StarlingDoveService.PutConfigurationRecorder" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON PutConfigurationRecorder where
  toJSON :: PutConfigurationRecorder -> Value
toJSON PutConfigurationRecorder' {ConfigurationRecorder
configurationRecorder :: ConfigurationRecorder
$sel:configurationRecorder:PutConfigurationRecorder' :: PutConfigurationRecorder -> ConfigurationRecorder
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ConfigurationRecorder"
                  Text -> ConfigurationRecorder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConfigurationRecorder
configurationRecorder
              )
          ]
      )

instance Core.ToPath PutConfigurationRecorder where
  toPath :: PutConfigurationRecorder -> ByteString
toPath = ByteString -> PutConfigurationRecorder -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery PutConfigurationRecorder where
  toQuery :: PutConfigurationRecorder -> QueryString
toQuery = QueryString -> PutConfigurationRecorder -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newPutConfigurationRecorderResponse' smart constructor.
data PutConfigurationRecorderResponse = PutConfigurationRecorderResponse'
  {
  }
  deriving (PutConfigurationRecorderResponse
-> PutConfigurationRecorderResponse -> Bool
(PutConfigurationRecorderResponse
 -> PutConfigurationRecorderResponse -> Bool)
-> (PutConfigurationRecorderResponse
    -> PutConfigurationRecorderResponse -> Bool)
-> Eq PutConfigurationRecorderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigurationRecorderResponse
-> PutConfigurationRecorderResponse -> Bool
$c/= :: PutConfigurationRecorderResponse
-> PutConfigurationRecorderResponse -> Bool
== :: PutConfigurationRecorderResponse
-> PutConfigurationRecorderResponse -> Bool
$c== :: PutConfigurationRecorderResponse
-> PutConfigurationRecorderResponse -> Bool
Prelude.Eq, ReadPrec [PutConfigurationRecorderResponse]
ReadPrec PutConfigurationRecorderResponse
Int -> ReadS PutConfigurationRecorderResponse
ReadS [PutConfigurationRecorderResponse]
(Int -> ReadS PutConfigurationRecorderResponse)
-> ReadS [PutConfigurationRecorderResponse]
-> ReadPrec PutConfigurationRecorderResponse
-> ReadPrec [PutConfigurationRecorderResponse]
-> Read PutConfigurationRecorderResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigurationRecorderResponse]
$creadListPrec :: ReadPrec [PutConfigurationRecorderResponse]
readPrec :: ReadPrec PutConfigurationRecorderResponse
$creadPrec :: ReadPrec PutConfigurationRecorderResponse
readList :: ReadS [PutConfigurationRecorderResponse]
$creadList :: ReadS [PutConfigurationRecorderResponse]
readsPrec :: Int -> ReadS PutConfigurationRecorderResponse
$creadsPrec :: Int -> ReadS PutConfigurationRecorderResponse
Prelude.Read, Int -> PutConfigurationRecorderResponse -> ShowS
[PutConfigurationRecorderResponse] -> ShowS
PutConfigurationRecorderResponse -> String
(Int -> PutConfigurationRecorderResponse -> ShowS)
-> (PutConfigurationRecorderResponse -> String)
-> ([PutConfigurationRecorderResponse] -> ShowS)
-> Show PutConfigurationRecorderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigurationRecorderResponse] -> ShowS
$cshowList :: [PutConfigurationRecorderResponse] -> ShowS
show :: PutConfigurationRecorderResponse -> String
$cshow :: PutConfigurationRecorderResponse -> String
showsPrec :: Int -> PutConfigurationRecorderResponse -> ShowS
$cshowsPrec :: Int -> PutConfigurationRecorderResponse -> ShowS
Prelude.Show, (forall x.
 PutConfigurationRecorderResponse
 -> Rep PutConfigurationRecorderResponse x)
-> (forall x.
    Rep PutConfigurationRecorderResponse x
    -> PutConfigurationRecorderResponse)
-> Generic PutConfigurationRecorderResponse
forall x.
Rep PutConfigurationRecorderResponse x
-> PutConfigurationRecorderResponse
forall x.
PutConfigurationRecorderResponse
-> Rep PutConfigurationRecorderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutConfigurationRecorderResponse x
-> PutConfigurationRecorderResponse
$cfrom :: forall x.
PutConfigurationRecorderResponse
-> Rep PutConfigurationRecorderResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutConfigurationRecorderResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newPutConfigurationRecorderResponse ::
  PutConfigurationRecorderResponse
newPutConfigurationRecorderResponse :: PutConfigurationRecorderResponse
newPutConfigurationRecorderResponse =
  PutConfigurationRecorderResponse
PutConfigurationRecorderResponse'

instance
  Prelude.NFData
    PutConfigurationRecorderResponse