{-# 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.IoTSiteWise.PutLoggingOptions
-- 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 logging options for IoT SiteWise.
module Amazonka.IoTSiteWise.PutLoggingOptions
  ( -- * Creating a Request
    PutLoggingOptions (..),
    newPutLoggingOptions,

    -- * Request Lenses
    putLoggingOptions_loggingOptions,

    -- * Destructuring the Response
    PutLoggingOptionsResponse (..),
    newPutLoggingOptionsResponse,

    -- * Response Lenses
    putLoggingOptionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.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:/ 'newPutLoggingOptions' smart constructor.
data PutLoggingOptions = PutLoggingOptions'
  { -- | The logging options to set.
    PutLoggingOptions -> LoggingOptions
loggingOptions :: LoggingOptions
  }
  deriving (PutLoggingOptions -> PutLoggingOptions -> Bool
(PutLoggingOptions -> PutLoggingOptions -> Bool)
-> (PutLoggingOptions -> PutLoggingOptions -> Bool)
-> Eq PutLoggingOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLoggingOptions -> PutLoggingOptions -> Bool
$c/= :: PutLoggingOptions -> PutLoggingOptions -> Bool
== :: PutLoggingOptions -> PutLoggingOptions -> Bool
$c== :: PutLoggingOptions -> PutLoggingOptions -> Bool
Prelude.Eq, ReadPrec [PutLoggingOptions]
ReadPrec PutLoggingOptions
Int -> ReadS PutLoggingOptions
ReadS [PutLoggingOptions]
(Int -> ReadS PutLoggingOptions)
-> ReadS [PutLoggingOptions]
-> ReadPrec PutLoggingOptions
-> ReadPrec [PutLoggingOptions]
-> Read PutLoggingOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLoggingOptions]
$creadListPrec :: ReadPrec [PutLoggingOptions]
readPrec :: ReadPrec PutLoggingOptions
$creadPrec :: ReadPrec PutLoggingOptions
readList :: ReadS [PutLoggingOptions]
$creadList :: ReadS [PutLoggingOptions]
readsPrec :: Int -> ReadS PutLoggingOptions
$creadsPrec :: Int -> ReadS PutLoggingOptions
Prelude.Read, Int -> PutLoggingOptions -> ShowS
[PutLoggingOptions] -> ShowS
PutLoggingOptions -> String
(Int -> PutLoggingOptions -> ShowS)
-> (PutLoggingOptions -> String)
-> ([PutLoggingOptions] -> ShowS)
-> Show PutLoggingOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLoggingOptions] -> ShowS
$cshowList :: [PutLoggingOptions] -> ShowS
show :: PutLoggingOptions -> String
$cshow :: PutLoggingOptions -> String
showsPrec :: Int -> PutLoggingOptions -> ShowS
$cshowsPrec :: Int -> PutLoggingOptions -> ShowS
Prelude.Show, (forall x. PutLoggingOptions -> Rep PutLoggingOptions x)
-> (forall x. Rep PutLoggingOptions x -> PutLoggingOptions)
-> Generic PutLoggingOptions
forall x. Rep PutLoggingOptions x -> PutLoggingOptions
forall x. PutLoggingOptions -> Rep PutLoggingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutLoggingOptions x -> PutLoggingOptions
$cfrom :: forall x. PutLoggingOptions -> Rep PutLoggingOptions x
Prelude.Generic)

-- |
-- Create a value of 'PutLoggingOptions' 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:
--
-- 'loggingOptions', 'putLoggingOptions_loggingOptions' - The logging options to set.
newPutLoggingOptions ::
  -- | 'loggingOptions'
  LoggingOptions ->
  PutLoggingOptions
newPutLoggingOptions :: LoggingOptions -> PutLoggingOptions
newPutLoggingOptions LoggingOptions
pLoggingOptions_ =
  PutLoggingOptions' :: LoggingOptions -> PutLoggingOptions
PutLoggingOptions'
    { $sel:loggingOptions:PutLoggingOptions' :: LoggingOptions
loggingOptions =
        LoggingOptions
pLoggingOptions_
    }

-- | The logging options to set.
putLoggingOptions_loggingOptions :: Lens.Lens' PutLoggingOptions LoggingOptions
putLoggingOptions_loggingOptions :: (LoggingOptions -> f LoggingOptions)
-> PutLoggingOptions -> f PutLoggingOptions
putLoggingOptions_loggingOptions = (PutLoggingOptions -> LoggingOptions)
-> (PutLoggingOptions -> LoggingOptions -> PutLoggingOptions)
-> Lens
     PutLoggingOptions PutLoggingOptions LoggingOptions LoggingOptions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLoggingOptions' {LoggingOptions
loggingOptions :: LoggingOptions
$sel:loggingOptions:PutLoggingOptions' :: PutLoggingOptions -> LoggingOptions
loggingOptions} -> LoggingOptions
loggingOptions) (\s :: PutLoggingOptions
s@PutLoggingOptions' {} LoggingOptions
a -> PutLoggingOptions
s {$sel:loggingOptions:PutLoggingOptions' :: LoggingOptions
loggingOptions = LoggingOptions
a} :: PutLoggingOptions)

instance Core.AWSRequest PutLoggingOptions where
  type
    AWSResponse PutLoggingOptions =
      PutLoggingOptionsResponse
  request :: PutLoggingOptions -> Request PutLoggingOptions
request = Service -> PutLoggingOptions -> Request PutLoggingOptions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutLoggingOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutLoggingOptions)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse PutLoggingOptions))
-> Logger
-> Service
-> Proxy PutLoggingOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutLoggingOptions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutLoggingOptionsResponse
PutLoggingOptionsResponse'
            (Int -> PutLoggingOptionsResponse)
-> Either String Int -> Either String PutLoggingOptionsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutLoggingOptions

instance Prelude.NFData PutLoggingOptions

instance Core.ToHeaders PutLoggingOptions where
  toHeaders :: PutLoggingOptions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutLoggingOptions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON PutLoggingOptions where
  toJSON :: PutLoggingOptions -> Value
toJSON PutLoggingOptions' {LoggingOptions
loggingOptions :: LoggingOptions
$sel:loggingOptions:PutLoggingOptions' :: PutLoggingOptions -> LoggingOptions
..} =
    [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
"loggingOptions" Text -> LoggingOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LoggingOptions
loggingOptions)
          ]
      )

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

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

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

-- |
-- Create a value of 'PutLoggingOptionsResponse' 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:
--
-- 'httpStatus', 'putLoggingOptionsResponse_httpStatus' - The response's http status code.
newPutLoggingOptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutLoggingOptionsResponse
newPutLoggingOptionsResponse :: Int -> PutLoggingOptionsResponse
newPutLoggingOptionsResponse Int
pHttpStatus_ =
  PutLoggingOptionsResponse' :: Int -> PutLoggingOptionsResponse
PutLoggingOptionsResponse'
    { $sel:httpStatus:PutLoggingOptionsResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
putLoggingOptionsResponse_httpStatus :: Lens.Lens' PutLoggingOptionsResponse Prelude.Int
putLoggingOptionsResponse_httpStatus :: (Int -> f Int)
-> PutLoggingOptionsResponse -> f PutLoggingOptionsResponse
putLoggingOptionsResponse_httpStatus = (PutLoggingOptionsResponse -> Int)
-> (PutLoggingOptionsResponse -> Int -> PutLoggingOptionsResponse)
-> Lens PutLoggingOptionsResponse PutLoggingOptionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLoggingOptionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutLoggingOptionsResponse' :: PutLoggingOptionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutLoggingOptionsResponse
s@PutLoggingOptionsResponse' {} Int
a -> PutLoggingOptionsResponse
s {$sel:httpStatus:PutLoggingOptionsResponse' :: Int
httpStatus = Int
a} :: PutLoggingOptionsResponse)

instance Prelude.NFData PutLoggingOptionsResponse