{-# 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.IoT.SetV2LoggingLevel
-- 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)
--
-- Sets the logging level.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions SetV2LoggingLevel>
-- action.
module Amazonka.IoT.SetV2LoggingLevel
  ( -- * Creating a Request
    SetV2LoggingLevel (..),
    newSetV2LoggingLevel,

    -- * Request Lenses
    setV2LoggingLevel_logTarget,
    setV2LoggingLevel_logLevel,

    -- * Destructuring the Response
    SetV2LoggingLevelResponse (..),
    newSetV2LoggingLevelResponse,
  )
where

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

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

-- |
-- Create a value of 'SetV2LoggingLevel' 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:
--
-- 'logTarget', 'setV2LoggingLevel_logTarget' - The log target.
--
-- 'logLevel', 'setV2LoggingLevel_logLevel' - The log level.
newSetV2LoggingLevel ::
  -- | 'logTarget'
  LogTarget ->
  -- | 'logLevel'
  LogLevel ->
  SetV2LoggingLevel
newSetV2LoggingLevel :: LogTarget -> LogLevel -> SetV2LoggingLevel
newSetV2LoggingLevel LogTarget
pLogTarget_ LogLevel
pLogLevel_ =
  SetV2LoggingLevel' :: LogTarget -> LogLevel -> SetV2LoggingLevel
SetV2LoggingLevel'
    { $sel:logTarget:SetV2LoggingLevel' :: LogTarget
logTarget = LogTarget
pLogTarget_,
      $sel:logLevel:SetV2LoggingLevel' :: LogLevel
logLevel = LogLevel
pLogLevel_
    }

-- | The log target.
setV2LoggingLevel_logTarget :: Lens.Lens' SetV2LoggingLevel LogTarget
setV2LoggingLevel_logTarget :: (LogTarget -> f LogTarget)
-> SetV2LoggingLevel -> f SetV2LoggingLevel
setV2LoggingLevel_logTarget = (SetV2LoggingLevel -> LogTarget)
-> (SetV2LoggingLevel -> LogTarget -> SetV2LoggingLevel)
-> Lens SetV2LoggingLevel SetV2LoggingLevel LogTarget LogTarget
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetV2LoggingLevel' {LogTarget
logTarget :: LogTarget
$sel:logTarget:SetV2LoggingLevel' :: SetV2LoggingLevel -> LogTarget
logTarget} -> LogTarget
logTarget) (\s :: SetV2LoggingLevel
s@SetV2LoggingLevel' {} LogTarget
a -> SetV2LoggingLevel
s {$sel:logTarget:SetV2LoggingLevel' :: LogTarget
logTarget = LogTarget
a} :: SetV2LoggingLevel)

-- | The log level.
setV2LoggingLevel_logLevel :: Lens.Lens' SetV2LoggingLevel LogLevel
setV2LoggingLevel_logLevel :: (LogLevel -> f LogLevel)
-> SetV2LoggingLevel -> f SetV2LoggingLevel
setV2LoggingLevel_logLevel = (SetV2LoggingLevel -> LogLevel)
-> (SetV2LoggingLevel -> LogLevel -> SetV2LoggingLevel)
-> Lens SetV2LoggingLevel SetV2LoggingLevel LogLevel LogLevel
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetV2LoggingLevel' {LogLevel
logLevel :: LogLevel
$sel:logLevel:SetV2LoggingLevel' :: SetV2LoggingLevel -> LogLevel
logLevel} -> LogLevel
logLevel) (\s :: SetV2LoggingLevel
s@SetV2LoggingLevel' {} LogLevel
a -> SetV2LoggingLevel
s {$sel:logLevel:SetV2LoggingLevel' :: LogLevel
logLevel = LogLevel
a} :: SetV2LoggingLevel)

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

instance Prelude.Hashable SetV2LoggingLevel

instance Prelude.NFData SetV2LoggingLevel

instance Core.ToHeaders SetV2LoggingLevel where
  toHeaders :: SetV2LoggingLevel -> [Header]
toHeaders = [Header] -> SetV2LoggingLevel -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON SetV2LoggingLevel where
  toJSON :: SetV2LoggingLevel -> Value
toJSON SetV2LoggingLevel' {LogLevel
LogTarget
logLevel :: LogLevel
logTarget :: LogTarget
$sel:logLevel:SetV2LoggingLevel' :: SetV2LoggingLevel -> LogLevel
$sel:logTarget:SetV2LoggingLevel' :: SetV2LoggingLevel -> LogTarget
..} =
    [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
"logTarget" Text -> LogTarget -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LogTarget
logTarget),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logLevel" Text -> LogLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LogLevel
logLevel)
          ]
      )

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

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

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

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

instance Prelude.NFData SetV2LoggingLevelResponse