{-# 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-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)
--
-- 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.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 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
(StartConfigurationRecorder -> StartConfigurationRecorder -> Bool)
-> (StartConfigurationRecorder
    -> StartConfigurationRecorder -> Bool)
-> Eq StartConfigurationRecorder
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]
(Int -> ReadS StartConfigurationRecorder)
-> ReadS [StartConfigurationRecorder]
-> ReadPrec StartConfigurationRecorder
-> ReadPrec [StartConfigurationRecorder]
-> Read 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
(Int -> StartConfigurationRecorder -> ShowS)
-> (StartConfigurationRecorder -> String)
-> ([StartConfigurationRecorder] -> ShowS)
-> Show StartConfigurationRecorder
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.
 StartConfigurationRecorder -> Rep StartConfigurationRecorder x)
-> (forall x.
    Rep StartConfigurationRecorder x -> StartConfigurationRecorder)
-> Generic StartConfigurationRecorder
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' :: Text -> StartConfigurationRecorder
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 :: (Text -> f Text)
-> StartConfigurationRecorder -> f StartConfigurationRecorder
startConfigurationRecorder_configurationRecorderName = (StartConfigurationRecorder -> Text)
-> (StartConfigurationRecorder
    -> Text -> StartConfigurationRecorder)
-> Lens
     StartConfigurationRecorder StartConfigurationRecorder Text Text
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 :: StartConfigurationRecorder -> Request StartConfigurationRecorder
request = Service
-> StartConfigurationRecorder -> Request StartConfigurationRecorder
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartConfigurationRecorder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartConfigurationRecorder)))
response =
    AWSResponse StartConfigurationRecorder
-> Logger
-> Service
-> Proxy StartConfigurationRecorder
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartConfigurationRecorder)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse StartConfigurationRecorder
StartConfigurationRecorderResponse
StartConfigurationRecorderResponse'

instance Prelude.Hashable StartConfigurationRecorder

instance Prelude.NFData StartConfigurationRecorder

instance Core.ToHeaders StartConfigurationRecorder where
  toHeaders :: StartConfigurationRecorder -> [Header]
toHeaders =
    [Header] -> StartConfigurationRecorder -> [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.StartConfigurationRecorder" ::
                          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 StartConfigurationRecorder where
  toJSON :: StartConfigurationRecorder -> Value
toJSON StartConfigurationRecorder' {Text
configurationRecorderName :: Text
$sel:configurationRecorderName:StartConfigurationRecorder' :: StartConfigurationRecorder -> Text
..} =
    [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
"ConfigurationRecorderName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
configurationRecorderName
              )
          ]
      )

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

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

-- | /See:/ 'newStartConfigurationRecorderResponse' smart constructor.
data StartConfigurationRecorderResponse = StartConfigurationRecorderResponse'
  {
  }
  deriving (StartConfigurationRecorderResponse
-> StartConfigurationRecorderResponse -> Bool
(StartConfigurationRecorderResponse
 -> StartConfigurationRecorderResponse -> Bool)
-> (StartConfigurationRecorderResponse
    -> StartConfigurationRecorderResponse -> Bool)
-> Eq StartConfigurationRecorderResponse
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]
(Int -> ReadS StartConfigurationRecorderResponse)
-> ReadS [StartConfigurationRecorderResponse]
-> ReadPrec StartConfigurationRecorderResponse
-> ReadPrec [StartConfigurationRecorderResponse]
-> Read 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
(Int -> StartConfigurationRecorderResponse -> ShowS)
-> (StartConfigurationRecorderResponse -> String)
-> ([StartConfigurationRecorderResponse] -> ShowS)
-> Show StartConfigurationRecorderResponse
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.
 StartConfigurationRecorderResponse
 -> Rep StartConfigurationRecorderResponse x)
-> (forall x.
    Rep StartConfigurationRecorderResponse x
    -> StartConfigurationRecorderResponse)
-> Generic StartConfigurationRecorderResponse
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