{-# 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.IoTFleetWise.GetLoggingOptions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the logging options.
module Amazonka.IoTFleetWise.GetLoggingOptions
  ( -- * Creating a Request
    GetLoggingOptions (..),
    newGetLoggingOptions,

    -- * Destructuring the Response
    GetLoggingOptionsResponse (..),
    newGetLoggingOptionsResponse,

    -- * Response Lenses
    getLoggingOptionsResponse_httpStatus,
    getLoggingOptionsResponse_cloudWatchLogDelivery,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTFleetWise.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

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

instance Core.AWSRequest GetLoggingOptions where
  type
    AWSResponse GetLoggingOptions =
      GetLoggingOptionsResponse
  request :: (Service -> Service)
-> GetLoggingOptions -> Request GetLoggingOptions
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetLoggingOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetLoggingOptions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> CloudWatchLogDeliveryOptions -> GetLoggingOptionsResponse
GetLoggingOptionsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"cloudWatchLogDelivery")
      )

instance Prelude.Hashable GetLoggingOptions where
  hashWithSalt :: Int -> GetLoggingOptions -> Int
hashWithSalt Int
_salt GetLoggingOptions
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetLoggingOptions where
  rnf :: GetLoggingOptions -> ()
rnf GetLoggingOptions
_ = ()

instance Data.ToHeaders GetLoggingOptions where
  toHeaders :: GetLoggingOptions -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"IoTAutobahnControlPlane.GetLoggingOptions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetLoggingOptions where
  toJSON :: GetLoggingOptions -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

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

-- |
-- Create a value of 'GetLoggingOptionsResponse' 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', 'getLoggingOptionsResponse_httpStatus' - The response's http status code.
--
-- 'cloudWatchLogDelivery', 'getLoggingOptionsResponse_cloudWatchLogDelivery' - Returns information about log delivery to Amazon CloudWatch Logs.
newGetLoggingOptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'cloudWatchLogDelivery'
  CloudWatchLogDeliveryOptions ->
  GetLoggingOptionsResponse
newGetLoggingOptionsResponse :: Int -> CloudWatchLogDeliveryOptions -> GetLoggingOptionsResponse
newGetLoggingOptionsResponse
  Int
pHttpStatus_
  CloudWatchLogDeliveryOptions
pCloudWatchLogDelivery_ =
    GetLoggingOptionsResponse'
      { $sel:httpStatus:GetLoggingOptionsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:cloudWatchLogDelivery:GetLoggingOptionsResponse' :: CloudWatchLogDeliveryOptions
cloudWatchLogDelivery = CloudWatchLogDeliveryOptions
pCloudWatchLogDelivery_
      }

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

-- | Returns information about log delivery to Amazon CloudWatch Logs.
getLoggingOptionsResponse_cloudWatchLogDelivery :: Lens.Lens' GetLoggingOptionsResponse CloudWatchLogDeliveryOptions
getLoggingOptionsResponse_cloudWatchLogDelivery :: Lens' GetLoggingOptionsResponse CloudWatchLogDeliveryOptions
getLoggingOptionsResponse_cloudWatchLogDelivery = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLoggingOptionsResponse' {CloudWatchLogDeliveryOptions
cloudWatchLogDelivery :: CloudWatchLogDeliveryOptions
$sel:cloudWatchLogDelivery:GetLoggingOptionsResponse' :: GetLoggingOptionsResponse -> CloudWatchLogDeliveryOptions
cloudWatchLogDelivery} -> CloudWatchLogDeliveryOptions
cloudWatchLogDelivery) (\s :: GetLoggingOptionsResponse
s@GetLoggingOptionsResponse' {} CloudWatchLogDeliveryOptions
a -> GetLoggingOptionsResponse
s {$sel:cloudWatchLogDelivery:GetLoggingOptionsResponse' :: CloudWatchLogDeliveryOptions
cloudWatchLogDelivery = CloudWatchLogDeliveryOptions
a} :: GetLoggingOptionsResponse)

instance Prelude.NFData GetLoggingOptionsResponse where
  rnf :: GetLoggingOptionsResponse -> ()
rnf GetLoggingOptionsResponse' {Int
CloudWatchLogDeliveryOptions
cloudWatchLogDelivery :: CloudWatchLogDeliveryOptions
httpStatus :: Int
$sel:cloudWatchLogDelivery:GetLoggingOptionsResponse' :: GetLoggingOptionsResponse -> CloudWatchLogDeliveryOptions
$sel:httpStatus:GetLoggingOptionsResponse' :: GetLoggingOptionsResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CloudWatchLogDeliveryOptions
cloudWatchLogDelivery