{-# 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.GetIndexingConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the indexing configuration.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions GetIndexingConfiguration>
-- action.
module Amazonka.IoT.GetIndexingConfiguration
  ( -- * Creating a Request
    GetIndexingConfiguration (..),
    newGetIndexingConfiguration,

    -- * Destructuring the Response
    GetIndexingConfigurationResponse (..),
    newGetIndexingConfigurationResponse,

    -- * Response Lenses
    getIndexingConfigurationResponse_thingGroupIndexingConfiguration,
    getIndexingConfigurationResponse_thingIndexingConfiguration,
    getIndexingConfigurationResponse_httpStatus,
  )
where

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

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

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

instance Core.AWSRequest GetIndexingConfiguration where
  type
    AWSResponse GetIndexingConfiguration =
      GetIndexingConfigurationResponse
  request :: (Service -> Service)
-> GetIndexingConfiguration -> Request GetIndexingConfiguration
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetIndexingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetIndexingConfiguration)))
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 ->
          Maybe ThingGroupIndexingConfiguration
-> Maybe ThingIndexingConfiguration
-> Int
-> GetIndexingConfigurationResponse
GetIndexingConfigurationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"thingGroupIndexingConfiguration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"thingIndexingConfiguration")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

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

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

instance Data.ToHeaders GetIndexingConfiguration where
  toHeaders :: GetIndexingConfiguration -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

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

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

-- |
-- Create a value of 'GetIndexingConfigurationResponse' 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:
--
-- 'thingGroupIndexingConfiguration', 'getIndexingConfigurationResponse_thingGroupIndexingConfiguration' - The index configuration.
--
-- 'thingIndexingConfiguration', 'getIndexingConfigurationResponse_thingIndexingConfiguration' - Thing indexing configuration.
--
-- 'httpStatus', 'getIndexingConfigurationResponse_httpStatus' - The response's http status code.
newGetIndexingConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetIndexingConfigurationResponse
newGetIndexingConfigurationResponse :: Int -> GetIndexingConfigurationResponse
newGetIndexingConfigurationResponse Int
pHttpStatus_ =
  GetIndexingConfigurationResponse'
    { $sel:thingGroupIndexingConfiguration:GetIndexingConfigurationResponse' :: Maybe ThingGroupIndexingConfiguration
thingGroupIndexingConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:thingIndexingConfiguration:GetIndexingConfigurationResponse' :: Maybe ThingIndexingConfiguration
thingIndexingConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetIndexingConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The index configuration.
getIndexingConfigurationResponse_thingGroupIndexingConfiguration :: Lens.Lens' GetIndexingConfigurationResponse (Prelude.Maybe ThingGroupIndexingConfiguration)
getIndexingConfigurationResponse_thingGroupIndexingConfiguration :: Lens'
  GetIndexingConfigurationResponse
  (Maybe ThingGroupIndexingConfiguration)
getIndexingConfigurationResponse_thingGroupIndexingConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIndexingConfigurationResponse' {Maybe ThingGroupIndexingConfiguration
thingGroupIndexingConfiguration :: Maybe ThingGroupIndexingConfiguration
$sel:thingGroupIndexingConfiguration:GetIndexingConfigurationResponse' :: GetIndexingConfigurationResponse
-> Maybe ThingGroupIndexingConfiguration
thingGroupIndexingConfiguration} -> Maybe ThingGroupIndexingConfiguration
thingGroupIndexingConfiguration) (\s :: GetIndexingConfigurationResponse
s@GetIndexingConfigurationResponse' {} Maybe ThingGroupIndexingConfiguration
a -> GetIndexingConfigurationResponse
s {$sel:thingGroupIndexingConfiguration:GetIndexingConfigurationResponse' :: Maybe ThingGroupIndexingConfiguration
thingGroupIndexingConfiguration = Maybe ThingGroupIndexingConfiguration
a} :: GetIndexingConfigurationResponse)

-- | Thing indexing configuration.
getIndexingConfigurationResponse_thingIndexingConfiguration :: Lens.Lens' GetIndexingConfigurationResponse (Prelude.Maybe ThingIndexingConfiguration)
getIndexingConfigurationResponse_thingIndexingConfiguration :: Lens'
  GetIndexingConfigurationResponse (Maybe ThingIndexingConfiguration)
getIndexingConfigurationResponse_thingIndexingConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIndexingConfigurationResponse' {Maybe ThingIndexingConfiguration
thingIndexingConfiguration :: Maybe ThingIndexingConfiguration
$sel:thingIndexingConfiguration:GetIndexingConfigurationResponse' :: GetIndexingConfigurationResponse
-> Maybe ThingIndexingConfiguration
thingIndexingConfiguration} -> Maybe ThingIndexingConfiguration
thingIndexingConfiguration) (\s :: GetIndexingConfigurationResponse
s@GetIndexingConfigurationResponse' {} Maybe ThingIndexingConfiguration
a -> GetIndexingConfigurationResponse
s {$sel:thingIndexingConfiguration:GetIndexingConfigurationResponse' :: Maybe ThingIndexingConfiguration
thingIndexingConfiguration = Maybe ThingIndexingConfiguration
a} :: GetIndexingConfigurationResponse)

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

instance
  Prelude.NFData
    GetIndexingConfigurationResponse
  where
  rnf :: GetIndexingConfigurationResponse -> ()
rnf GetIndexingConfigurationResponse' {Int
Maybe ThingGroupIndexingConfiguration
Maybe ThingIndexingConfiguration
httpStatus :: Int
thingIndexingConfiguration :: Maybe ThingIndexingConfiguration
thingGroupIndexingConfiguration :: Maybe ThingGroupIndexingConfiguration
$sel:httpStatus:GetIndexingConfigurationResponse' :: GetIndexingConfigurationResponse -> Int
$sel:thingIndexingConfiguration:GetIndexingConfigurationResponse' :: GetIndexingConfigurationResponse
-> Maybe ThingIndexingConfiguration
$sel:thingGroupIndexingConfiguration:GetIndexingConfigurationResponse' :: GetIndexingConfigurationResponse
-> Maybe ThingGroupIndexingConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ThingGroupIndexingConfiguration
thingGroupIndexingConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThingIndexingConfiguration
thingIndexingConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus