{-# 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.IoTAnalytics.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 settings of the IoT Analytics logging options.
module Amazonka.IoTAnalytics.DescribeLoggingOptions
  ( -- * Creating a Request
    DescribeLoggingOptions (..),
    newDescribeLoggingOptions,

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

    -- * Response Lenses
    describeLoggingOptionsResponse_loggingOptions,
    describeLoggingOptionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.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 ->
          Maybe LoggingOptions -> Int -> DescribeLoggingOptionsResponse
DescribeLoggingOptionsResponse'
            (Maybe LoggingOptions -> Int -> DescribeLoggingOptionsResponse)
-> Either String (Maybe LoggingOptions)
-> Either String (Int -> DescribeLoggingOptionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe LoggingOptions)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"loggingOptions")
            Either String (Int -> DescribeLoggingOptionsResponse)
-> Either String Int
-> Either String DescribeLoggingOptionsResponse
forall (f :: * -> *) a b. Applicative f => 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 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
forall a. Monoid a => a
Prelude.mempty

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 current settings of the IoT Analytics logging options.
    DescribeLoggingOptionsResponse -> Maybe LoggingOptions
loggingOptions :: Prelude.Maybe LoggingOptions,
    -- | The response's http status code.
    DescribeLoggingOptionsResponse -> Int
httpStatus :: Prelude.Int
  }
  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:
--
-- 'loggingOptions', 'describeLoggingOptionsResponse_loggingOptions' - The current settings of the IoT Analytics logging options.
--
-- 'httpStatus', 'describeLoggingOptionsResponse_httpStatus' - The response's http status code.
newDescribeLoggingOptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeLoggingOptionsResponse
newDescribeLoggingOptionsResponse :: Int -> DescribeLoggingOptionsResponse
newDescribeLoggingOptionsResponse Int
pHttpStatus_ =
  DescribeLoggingOptionsResponse' :: Maybe LoggingOptions -> Int -> DescribeLoggingOptionsResponse
DescribeLoggingOptionsResponse'
    { $sel:loggingOptions:DescribeLoggingOptionsResponse' :: Maybe LoggingOptions
loggingOptions =
        Maybe LoggingOptions
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeLoggingOptionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | 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)

instance
  Prelude.NFData
    DescribeLoggingOptionsResponse