{-# 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-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)
--
-- 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 Amazonka.IoT.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:/ 'newGetIndexingConfiguration' smart constructor.
data GetIndexingConfiguration = GetIndexingConfiguration'
  {
  }
  deriving (GetIndexingConfiguration -> GetIndexingConfiguration -> Bool
(GetIndexingConfiguration -> GetIndexingConfiguration -> Bool)
-> (GetIndexingConfiguration -> GetIndexingConfiguration -> Bool)
-> Eq GetIndexingConfiguration
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]
(Int -> ReadS GetIndexingConfiguration)
-> ReadS [GetIndexingConfiguration]
-> ReadPrec GetIndexingConfiguration
-> ReadPrec [GetIndexingConfiguration]
-> Read 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
(Int -> GetIndexingConfiguration -> ShowS)
-> (GetIndexingConfiguration -> String)
-> ([GetIndexingConfiguration] -> ShowS)
-> Show GetIndexingConfiguration
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.
 GetIndexingConfiguration -> Rep GetIndexingConfiguration x)
-> (forall x.
    Rep GetIndexingConfiguration x -> GetIndexingConfiguration)
-> Generic GetIndexingConfiguration
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 :: GetIndexingConfiguration -> Request GetIndexingConfiguration
request = Service
-> GetIndexingConfiguration -> Request GetIndexingConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetIndexingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetIndexingConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetIndexingConfiguration))
-> Logger
-> Service
-> Proxy GetIndexingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetIndexingConfiguration)))
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 ThingGroupIndexingConfiguration
-> Maybe ThingIndexingConfiguration
-> Int
-> GetIndexingConfigurationResponse
GetIndexingConfigurationResponse'
            (Maybe ThingGroupIndexingConfiguration
 -> Maybe ThingIndexingConfiguration
 -> Int
 -> GetIndexingConfigurationResponse)
-> Either String (Maybe ThingGroupIndexingConfiguration)
-> Either
     String
     (Maybe ThingIndexingConfiguration
      -> Int -> GetIndexingConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Key -> Either String (Maybe ThingGroupIndexingConfiguration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"thingGroupIndexingConfiguration")
            Either
  String
  (Maybe ThingIndexingConfiguration
   -> Int -> GetIndexingConfigurationResponse)
-> Either String (Maybe ThingIndexingConfiguration)
-> Either String (Int -> GetIndexingConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String (Maybe ThingIndexingConfiguration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"thingIndexingConfiguration")
            Either String (Int -> GetIndexingConfigurationResponse)
-> Either String Int
-> Either String GetIndexingConfigurationResponse
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 GetIndexingConfiguration

instance Prelude.NFData GetIndexingConfiguration

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

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

instance Core.ToQuery GetIndexingConfiguration where
  toQuery :: GetIndexingConfiguration -> QueryString
toQuery = QueryString -> GetIndexingConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetIndexingConfigurationResponse
 -> GetIndexingConfigurationResponse -> Bool)
-> (GetIndexingConfigurationResponse
    -> GetIndexingConfigurationResponse -> Bool)
-> Eq GetIndexingConfigurationResponse
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]
(Int -> ReadS GetIndexingConfigurationResponse)
-> ReadS [GetIndexingConfigurationResponse]
-> ReadPrec GetIndexingConfigurationResponse
-> ReadPrec [GetIndexingConfigurationResponse]
-> Read 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
(Int -> GetIndexingConfigurationResponse -> ShowS)
-> (GetIndexingConfigurationResponse -> String)
-> ([GetIndexingConfigurationResponse] -> ShowS)
-> Show GetIndexingConfigurationResponse
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.
 GetIndexingConfigurationResponse
 -> Rep GetIndexingConfigurationResponse x)
-> (forall x.
    Rep GetIndexingConfigurationResponse x
    -> GetIndexingConfigurationResponse)
-> Generic GetIndexingConfigurationResponse
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' :: Maybe ThingGroupIndexingConfiguration
-> Maybe ThingIndexingConfiguration
-> Int
-> GetIndexingConfigurationResponse
GetIndexingConfigurationResponse'
    { $sel:thingGroupIndexingConfiguration:GetIndexingConfigurationResponse' :: Maybe ThingGroupIndexingConfiguration
thingGroupIndexingConfiguration =
        Maybe ThingGroupIndexingConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:thingIndexingConfiguration:GetIndexingConfigurationResponse' :: Maybe ThingIndexingConfiguration
thingIndexingConfiguration =
        Maybe 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 :: (Maybe ThingGroupIndexingConfiguration
 -> f (Maybe ThingGroupIndexingConfiguration))
-> GetIndexingConfigurationResponse
-> f GetIndexingConfigurationResponse
getIndexingConfigurationResponse_thingGroupIndexingConfiguration = (GetIndexingConfigurationResponse
 -> Maybe ThingGroupIndexingConfiguration)
-> (GetIndexingConfigurationResponse
    -> Maybe ThingGroupIndexingConfiguration
    -> GetIndexingConfigurationResponse)
-> Lens
     GetIndexingConfigurationResponse
     GetIndexingConfigurationResponse
     (Maybe ThingGroupIndexingConfiguration)
     (Maybe 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 :: (Maybe ThingIndexingConfiguration
 -> f (Maybe ThingIndexingConfiguration))
-> GetIndexingConfigurationResponse
-> f GetIndexingConfigurationResponse
getIndexingConfigurationResponse_thingIndexingConfiguration = (GetIndexingConfigurationResponse
 -> Maybe ThingIndexingConfiguration)
-> (GetIndexingConfigurationResponse
    -> Maybe ThingIndexingConfiguration
    -> GetIndexingConfigurationResponse)
-> Lens
     GetIndexingConfigurationResponse
     GetIndexingConfigurationResponse
     (Maybe ThingIndexingConfiguration)
     (Maybe 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 :: (Int -> f Int)
-> GetIndexingConfigurationResponse
-> f GetIndexingConfigurationResponse
getIndexingConfigurationResponse_httpStatus = (GetIndexingConfigurationResponse -> Int)
-> (GetIndexingConfigurationResponse
    -> Int -> GetIndexingConfigurationResponse)
-> Lens
     GetIndexingConfigurationResponse
     GetIndexingConfigurationResponse
     Int
     Int
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