{-# 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.DescribeLoggingOptions
-- 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)
--
-- Retrieves the current IoT SiteWise logging options.
module Amazonka.IoTSiteWise.DescribeLoggingOptions
  ( -- * Creating a Request
    DescribeLoggingOptions (..),
    newDescribeLoggingOptions,

    -- * Destructuring the Response
    DescribeLoggingOptionsResponse (..),
    newDescribeLoggingOptionsResponse,

    -- * Response Lenses
    describeLoggingOptionsResponse_httpStatus,
    describeLoggingOptionsResponse_loggingOptions,
  )
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:/ 'newDescribeLoggingOptions' smart constructor.
data DescribeLoggingOptions = DescribeLoggingOptions'
  {
  }
  deriving (DescribeLoggingOptions -> DescribeLoggingOptions -> Bool
(DescribeLoggingOptions -> DescribeLoggingOptions -> Bool)
-> (DescribeLoggingOptions -> DescribeLoggingOptions -> Bool)
-> Eq DescribeLoggingOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLoggingOptions -> DescribeLoggingOptions -> Bool
$c/= :: DescribeLoggingOptions -> DescribeLoggingOptions -> Bool
== :: DescribeLoggingOptions -> DescribeLoggingOptions -> Bool
$c== :: DescribeLoggingOptions -> DescribeLoggingOptions -> Bool
Prelude.Eq, ReadPrec [DescribeLoggingOptions]
ReadPrec DescribeLoggingOptions
Int -> ReadS DescribeLoggingOptions
ReadS [DescribeLoggingOptions]
(Int -> ReadS DescribeLoggingOptions)
-> ReadS [DescribeLoggingOptions]
-> ReadPrec DescribeLoggingOptions
-> ReadPrec [DescribeLoggingOptions]
-> Read DescribeLoggingOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLoggingOptions]
$creadListPrec :: ReadPrec [DescribeLoggingOptions]
readPrec :: ReadPrec DescribeLoggingOptions
$creadPrec :: ReadPrec DescribeLoggingOptions
readList :: ReadS [DescribeLoggingOptions]
$creadList :: ReadS [DescribeLoggingOptions]
readsPrec :: Int -> ReadS DescribeLoggingOptions
$creadsPrec :: Int -> ReadS DescribeLoggingOptions
Prelude.Read, Int -> DescribeLoggingOptions -> ShowS
[DescribeLoggingOptions] -> ShowS
DescribeLoggingOptions -> String
(Int -> DescribeLoggingOptions -> ShowS)
-> (DescribeLoggingOptions -> String)
-> ([DescribeLoggingOptions] -> ShowS)
-> Show DescribeLoggingOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLoggingOptions] -> ShowS
$cshowList :: [DescribeLoggingOptions] -> ShowS
show :: DescribeLoggingOptions -> String
$cshow :: DescribeLoggingOptions -> String
showsPrec :: Int -> DescribeLoggingOptions -> ShowS
$cshowsPrec :: Int -> DescribeLoggingOptions -> ShowS
Prelude.Show, (forall x. DescribeLoggingOptions -> Rep DescribeLoggingOptions x)
-> (forall x.
    Rep DescribeLoggingOptions x -> DescribeLoggingOptions)
-> Generic DescribeLoggingOptions
forall x. Rep DescribeLoggingOptions x -> DescribeLoggingOptions
forall x. DescribeLoggingOptions -> Rep DescribeLoggingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeLoggingOptions x -> DescribeLoggingOptions
$cfrom :: forall x. DescribeLoggingOptions -> Rep DescribeLoggingOptions x
Prelude.Generic)

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

instance Core.AWSRequest DescribeLoggingOptions where
  type
    AWSResponse DescribeLoggingOptions =
      DescribeLoggingOptionsResponse
  request :: DescribeLoggingOptions -> Request DescribeLoggingOptions
request = Service -> DescribeLoggingOptions -> Request DescribeLoggingOptions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeLoggingOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLoggingOptions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeLoggingOptions))
-> Logger
-> Service
-> Proxy DescribeLoggingOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLoggingOptions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> LoggingOptions -> DescribeLoggingOptionsResponse
DescribeLoggingOptionsResponse'
            (Int -> LoggingOptions -> DescribeLoggingOptionsResponse)
-> Either String Int
-> Either String (LoggingOptions -> DescribeLoggingOptionsResponse)
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))
            Either String (LoggingOptions -> DescribeLoggingOptionsResponse)
-> Either String LoggingOptions
-> Either String DescribeLoggingOptionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String LoggingOptions
forall a. FromJSON a => Object -> Key -> Either String a
Core..:> Key
"loggingOptions")
      )

instance Prelude.Hashable DescribeLoggingOptions

instance Prelude.NFData DescribeLoggingOptions

instance Core.ToHeaders DescribeLoggingOptions where
  toHeaders :: DescribeLoggingOptions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeLoggingOptions -> 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.ToPath DescribeLoggingOptions where
  toPath :: DescribeLoggingOptions -> ByteString
toPath = ByteString -> DescribeLoggingOptions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/logging"

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

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

-- |
-- Create a value of 'DescribeLoggingOptionsResponse' 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', 'describeLoggingOptionsResponse_httpStatus' - The response's http status code.
--
-- 'loggingOptions', 'describeLoggingOptionsResponse_loggingOptions' - The current logging options.
newDescribeLoggingOptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'loggingOptions'
  LoggingOptions ->
  DescribeLoggingOptionsResponse
newDescribeLoggingOptionsResponse :: Int -> LoggingOptions -> DescribeLoggingOptionsResponse
newDescribeLoggingOptionsResponse
  Int
pHttpStatus_
  LoggingOptions
pLoggingOptions_ =
    DescribeLoggingOptionsResponse' :: Int -> LoggingOptions -> DescribeLoggingOptionsResponse
DescribeLoggingOptionsResponse'
      { $sel:httpStatus:DescribeLoggingOptionsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:loggingOptions:DescribeLoggingOptionsResponse' :: LoggingOptions
loggingOptions = LoggingOptions
pLoggingOptions_
      }

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

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

instance
  Prelude.NFData
    DescribeLoggingOptionsResponse