{-# 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.StartConfigurationRecorder
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts recording configurations of the Amazon Web Services resources you
-- have selected to record in your Amazon Web Services account.
--
-- You must have created at least one delivery channel to successfully
-- start the configuration recorder.
module Amazonka.Config.StartConfigurationRecorder
  ( -- * Creating a Request
    StartConfigurationRecorder (..),
    newStartConfigurationRecorder,

    -- * Request Lenses
    startConfigurationRecorder_configurationRecorderName,

    -- * Destructuring the Response
    StartConfigurationRecorderResponse (..),
    newStartConfigurationRecorderResponse,
  )
where

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

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

-- |
-- Create a value of 'StartConfigurationRecorder' 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:
--
-- 'configurationRecorderName', 'startConfigurationRecorder_configurationRecorderName' - The name of the recorder object that records each configuration change
-- made to the resources.
newStartConfigurationRecorder ::
  -- | 'configurationRecorderName'
  Prelude.Text ->
  StartConfigurationRecorder
newStartConfigurationRecorder :: Text -> StartConfigurationRecorder
newStartConfigurationRecorder
  Text
pConfigurationRecorderName_ =
    StartConfigurationRecorder'
      { $sel:configurationRecorderName:StartConfigurationRecorder' :: Text
configurationRecorderName =
          Text
pConfigurationRecorderName_
      }

-- | The name of the recorder object that records each configuration change
-- made to the resources.
startConfigurationRecorder_configurationRecorderName :: Lens.Lens' StartConfigurationRecorder Prelude.Text
startConfigurationRecorder_configurationRecorderName :: Lens' StartConfigurationRecorder Text
startConfigurationRecorder_configurationRecorderName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartConfigurationRecorder' {Text
configurationRecorderName :: Text
$sel:configurationRecorderName:StartConfigurationRecorder' :: StartConfigurationRecorder -> Text
configurationRecorderName} -> Text
configurationRecorderName) (\s :: StartConfigurationRecorder
s@StartConfigurationRecorder' {} Text
a -> StartConfigurationRecorder
s {$sel:configurationRecorderName:StartConfigurationRecorder' :: Text
configurationRecorderName = Text
a} :: StartConfigurationRecorder)

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

instance Prelude.Hashable StartConfigurationRecorder where
  hashWithSalt :: Int -> StartConfigurationRecorder -> Int
hashWithSalt Int
_salt StartConfigurationRecorder' {Text
configurationRecorderName :: Text
$sel:configurationRecorderName:StartConfigurationRecorder' :: StartConfigurationRecorder -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationRecorderName

instance Prelude.NFData StartConfigurationRecorder where
  rnf :: StartConfigurationRecorder -> ()
rnf StartConfigurationRecorder' {Text
configurationRecorderName :: Text
$sel:configurationRecorderName:StartConfigurationRecorder' :: StartConfigurationRecorder -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
configurationRecorderName

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

instance Data.ToJSON StartConfigurationRecorder where
  toJSON :: StartConfigurationRecorder -> Value
toJSON StartConfigurationRecorder' {Text
configurationRecorderName :: Text
$sel:configurationRecorderName:StartConfigurationRecorder' :: StartConfigurationRecorder -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ConfigurationRecorderName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
configurationRecorderName
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'StartConfigurationRecorderResponse' 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.
newStartConfigurationRecorderResponse ::
  StartConfigurationRecorderResponse
newStartConfigurationRecorderResponse :: StartConfigurationRecorderResponse
newStartConfigurationRecorderResponse =
  StartConfigurationRecorderResponse
StartConfigurationRecorderResponse'

instance
  Prelude.NFData
    StartConfigurationRecorderResponse
  where
  rnf :: StartConfigurationRecorderResponse -> ()
rnf StartConfigurationRecorderResponse
_ = ()