{-# 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.SearchIndex
-- 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)
--
-- The query search index.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions SearchIndex>
-- action.
module Amazonka.IoT.SearchIndex
  ( -- * Creating a Request
    SearchIndex (..),
    newSearchIndex,

    -- * Request Lenses
    searchIndex_queryVersion,
    searchIndex_nextToken,
    searchIndex_maxResults,
    searchIndex_indexName,
    searchIndex_queryString,

    -- * Destructuring the Response
    SearchIndexResponse (..),
    newSearchIndexResponse,

    -- * Response Lenses
    searchIndexResponse_thingGroups,
    searchIndexResponse_nextToken,
    searchIndexResponse_things,
    searchIndexResponse_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:/ 'newSearchIndex' smart constructor.
data SearchIndex = SearchIndex'
  { -- | The query version.
    SearchIndex -> Maybe Text
queryVersion :: Prelude.Maybe Prelude.Text,
    -- | The token used to get the next set of results, or @null@ if there are no
    -- additional results.
    SearchIndex -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return at one time.
    SearchIndex -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The search index name.
    SearchIndex -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    -- | The search query string.
    SearchIndex -> Text
queryString :: Prelude.Text
  }
  deriving (SearchIndex -> SearchIndex -> Bool
(SearchIndex -> SearchIndex -> Bool)
-> (SearchIndex -> SearchIndex -> Bool) -> Eq SearchIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchIndex -> SearchIndex -> Bool
$c/= :: SearchIndex -> SearchIndex -> Bool
== :: SearchIndex -> SearchIndex -> Bool
$c== :: SearchIndex -> SearchIndex -> Bool
Prelude.Eq, ReadPrec [SearchIndex]
ReadPrec SearchIndex
Int -> ReadS SearchIndex
ReadS [SearchIndex]
(Int -> ReadS SearchIndex)
-> ReadS [SearchIndex]
-> ReadPrec SearchIndex
-> ReadPrec [SearchIndex]
-> Read SearchIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchIndex]
$creadListPrec :: ReadPrec [SearchIndex]
readPrec :: ReadPrec SearchIndex
$creadPrec :: ReadPrec SearchIndex
readList :: ReadS [SearchIndex]
$creadList :: ReadS [SearchIndex]
readsPrec :: Int -> ReadS SearchIndex
$creadsPrec :: Int -> ReadS SearchIndex
Prelude.Read, Int -> SearchIndex -> ShowS
[SearchIndex] -> ShowS
SearchIndex -> String
(Int -> SearchIndex -> ShowS)
-> (SearchIndex -> String)
-> ([SearchIndex] -> ShowS)
-> Show SearchIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchIndex] -> ShowS
$cshowList :: [SearchIndex] -> ShowS
show :: SearchIndex -> String
$cshow :: SearchIndex -> String
showsPrec :: Int -> SearchIndex -> ShowS
$cshowsPrec :: Int -> SearchIndex -> ShowS
Prelude.Show, (forall x. SearchIndex -> Rep SearchIndex x)
-> (forall x. Rep SearchIndex x -> SearchIndex)
-> Generic SearchIndex
forall x. Rep SearchIndex x -> SearchIndex
forall x. SearchIndex -> Rep SearchIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchIndex x -> SearchIndex
$cfrom :: forall x. SearchIndex -> Rep SearchIndex x
Prelude.Generic)

-- |
-- Create a value of 'SearchIndex' 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:
--
-- 'queryVersion', 'searchIndex_queryVersion' - The query version.
--
-- 'nextToken', 'searchIndex_nextToken' - The token used to get the next set of results, or @null@ if there are no
-- additional results.
--
-- 'maxResults', 'searchIndex_maxResults' - The maximum number of results to return at one time.
--
-- 'indexName', 'searchIndex_indexName' - The search index name.
--
-- 'queryString', 'searchIndex_queryString' - The search query string.
newSearchIndex ::
  -- | 'queryString'
  Prelude.Text ->
  SearchIndex
newSearchIndex :: Text -> SearchIndex
newSearchIndex Text
pQueryString_ =
  SearchIndex' :: Maybe Text
-> Maybe Text -> Maybe Natural -> Maybe Text -> Text -> SearchIndex
SearchIndex'
    { $sel:queryVersion:SearchIndex' :: Maybe Text
queryVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchIndex' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchIndex' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:SearchIndex' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:queryString:SearchIndex' :: Text
queryString = Text
pQueryString_
    }

-- | The query version.
searchIndex_queryVersion :: Lens.Lens' SearchIndex (Prelude.Maybe Prelude.Text)
searchIndex_queryVersion :: (Maybe Text -> f (Maybe Text)) -> SearchIndex -> f SearchIndex
searchIndex_queryVersion = (SearchIndex -> Maybe Text)
-> (SearchIndex -> Maybe Text -> SearchIndex)
-> Lens SearchIndex SearchIndex (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndex' {Maybe Text
queryVersion :: Maybe Text
$sel:queryVersion:SearchIndex' :: SearchIndex -> Maybe Text
queryVersion} -> Maybe Text
queryVersion) (\s :: SearchIndex
s@SearchIndex' {} Maybe Text
a -> SearchIndex
s {$sel:queryVersion:SearchIndex' :: Maybe Text
queryVersion = Maybe Text
a} :: SearchIndex)

-- | The token used to get the next set of results, or @null@ if there are no
-- additional results.
searchIndex_nextToken :: Lens.Lens' SearchIndex (Prelude.Maybe Prelude.Text)
searchIndex_nextToken :: (Maybe Text -> f (Maybe Text)) -> SearchIndex -> f SearchIndex
searchIndex_nextToken = (SearchIndex -> Maybe Text)
-> (SearchIndex -> Maybe Text -> SearchIndex)
-> Lens SearchIndex SearchIndex (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndex' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchIndex' :: SearchIndex -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchIndex
s@SearchIndex' {} Maybe Text
a -> SearchIndex
s {$sel:nextToken:SearchIndex' :: Maybe Text
nextToken = Maybe Text
a} :: SearchIndex)

-- | The maximum number of results to return at one time.
searchIndex_maxResults :: Lens.Lens' SearchIndex (Prelude.Maybe Prelude.Natural)
searchIndex_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchIndex -> f SearchIndex
searchIndex_maxResults = (SearchIndex -> Maybe Natural)
-> (SearchIndex -> Maybe Natural -> SearchIndex)
-> Lens SearchIndex SearchIndex (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndex' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchIndex' :: SearchIndex -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchIndex
s@SearchIndex' {} Maybe Natural
a -> SearchIndex
s {$sel:maxResults:SearchIndex' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchIndex)

-- | The search index name.
searchIndex_indexName :: Lens.Lens' SearchIndex (Prelude.Maybe Prelude.Text)
searchIndex_indexName :: (Maybe Text -> f (Maybe Text)) -> SearchIndex -> f SearchIndex
searchIndex_indexName = (SearchIndex -> Maybe Text)
-> (SearchIndex -> Maybe Text -> SearchIndex)
-> Lens SearchIndex SearchIndex (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndex' {Maybe Text
indexName :: Maybe Text
$sel:indexName:SearchIndex' :: SearchIndex -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: SearchIndex
s@SearchIndex' {} Maybe Text
a -> SearchIndex
s {$sel:indexName:SearchIndex' :: Maybe Text
indexName = Maybe Text
a} :: SearchIndex)

-- | The search query string.
searchIndex_queryString :: Lens.Lens' SearchIndex Prelude.Text
searchIndex_queryString :: (Text -> f Text) -> SearchIndex -> f SearchIndex
searchIndex_queryString = (SearchIndex -> Text)
-> (SearchIndex -> Text -> SearchIndex)
-> Lens SearchIndex SearchIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndex' {Text
queryString :: Text
$sel:queryString:SearchIndex' :: SearchIndex -> Text
queryString} -> Text
queryString) (\s :: SearchIndex
s@SearchIndex' {} Text
a -> SearchIndex
s {$sel:queryString:SearchIndex' :: Text
queryString = Text
a} :: SearchIndex)

instance Core.AWSRequest SearchIndex where
  type AWSResponse SearchIndex = SearchIndexResponse
  request :: SearchIndex -> Request SearchIndex
request = Service -> SearchIndex -> Request SearchIndex
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SearchIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchIndex)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SearchIndex))
-> Logger
-> Service
-> Proxy SearchIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchIndex)))
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 [ThingGroupDocument]
-> Maybe Text
-> Maybe [ThingDocument]
-> Int
-> SearchIndexResponse
SearchIndexResponse'
            (Maybe [ThingGroupDocument]
 -> Maybe Text
 -> Maybe [ThingDocument]
 -> Int
 -> SearchIndexResponse)
-> Either String (Maybe [ThingGroupDocument])
-> Either
     String
     (Maybe Text -> Maybe [ThingDocument] -> Int -> SearchIndexResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [ThingGroupDocument]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"thingGroups" Either String (Maybe (Maybe [ThingGroupDocument]))
-> Maybe [ThingGroupDocument]
-> Either String (Maybe [ThingGroupDocument])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ThingGroupDocument]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text -> Maybe [ThingDocument] -> Int -> SearchIndexResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [ThingDocument] -> Int -> SearchIndexResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Maybe [ThingDocument] -> Int -> SearchIndexResponse)
-> Either String (Maybe [ThingDocument])
-> Either String (Int -> SearchIndexResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ThingDocument]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"things" Either String (Maybe (Maybe [ThingDocument]))
-> Maybe [ThingDocument] -> Either String (Maybe [ThingDocument])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ThingDocument]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> SearchIndexResponse)
-> Either String Int -> Either String SearchIndexResponse
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 SearchIndex

instance Prelude.NFData SearchIndex

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

instance Core.ToJSON SearchIndex where
  toJSON :: SearchIndex -> Value
toJSON SearchIndex' {Maybe Natural
Maybe Text
Text
queryString :: Text
indexName :: Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
queryVersion :: Maybe Text
$sel:queryString:SearchIndex' :: SearchIndex -> Text
$sel:indexName:SearchIndex' :: SearchIndex -> Maybe Text
$sel:maxResults:SearchIndex' :: SearchIndex -> Maybe Natural
$sel:nextToken:SearchIndex' :: SearchIndex -> Maybe Text
$sel:queryVersion:SearchIndex' :: SearchIndex -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"queryVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queryVersion,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"indexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
indexName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"queryString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryString)
          ]
      )

instance Core.ToPath SearchIndex where
  toPath :: SearchIndex -> ByteString
toPath = ByteString -> SearchIndex -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/indices/search"

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

-- | /See:/ 'newSearchIndexResponse' smart constructor.
data SearchIndexResponse = SearchIndexResponse'
  { -- | The thing groups that match the search query.
    SearchIndexResponse -> Maybe [ThingGroupDocument]
thingGroups :: Prelude.Maybe [ThingGroupDocument],
    -- | The token used to get the next set of results, or @null@ if there are no
    -- additional results.
    SearchIndexResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The things that match the search query.
    SearchIndexResponse -> Maybe [ThingDocument]
things :: Prelude.Maybe [ThingDocument],
    -- | The response's http status code.
    SearchIndexResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchIndexResponse -> SearchIndexResponse -> Bool
(SearchIndexResponse -> SearchIndexResponse -> Bool)
-> (SearchIndexResponse -> SearchIndexResponse -> Bool)
-> Eq SearchIndexResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchIndexResponse -> SearchIndexResponse -> Bool
$c/= :: SearchIndexResponse -> SearchIndexResponse -> Bool
== :: SearchIndexResponse -> SearchIndexResponse -> Bool
$c== :: SearchIndexResponse -> SearchIndexResponse -> Bool
Prelude.Eq, ReadPrec [SearchIndexResponse]
ReadPrec SearchIndexResponse
Int -> ReadS SearchIndexResponse
ReadS [SearchIndexResponse]
(Int -> ReadS SearchIndexResponse)
-> ReadS [SearchIndexResponse]
-> ReadPrec SearchIndexResponse
-> ReadPrec [SearchIndexResponse]
-> Read SearchIndexResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchIndexResponse]
$creadListPrec :: ReadPrec [SearchIndexResponse]
readPrec :: ReadPrec SearchIndexResponse
$creadPrec :: ReadPrec SearchIndexResponse
readList :: ReadS [SearchIndexResponse]
$creadList :: ReadS [SearchIndexResponse]
readsPrec :: Int -> ReadS SearchIndexResponse
$creadsPrec :: Int -> ReadS SearchIndexResponse
Prelude.Read, Int -> SearchIndexResponse -> ShowS
[SearchIndexResponse] -> ShowS
SearchIndexResponse -> String
(Int -> SearchIndexResponse -> ShowS)
-> (SearchIndexResponse -> String)
-> ([SearchIndexResponse] -> ShowS)
-> Show SearchIndexResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchIndexResponse] -> ShowS
$cshowList :: [SearchIndexResponse] -> ShowS
show :: SearchIndexResponse -> String
$cshow :: SearchIndexResponse -> String
showsPrec :: Int -> SearchIndexResponse -> ShowS
$cshowsPrec :: Int -> SearchIndexResponse -> ShowS
Prelude.Show, (forall x. SearchIndexResponse -> Rep SearchIndexResponse x)
-> (forall x. Rep SearchIndexResponse x -> SearchIndexResponse)
-> Generic SearchIndexResponse
forall x. Rep SearchIndexResponse x -> SearchIndexResponse
forall x. SearchIndexResponse -> Rep SearchIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchIndexResponse x -> SearchIndexResponse
$cfrom :: forall x. SearchIndexResponse -> Rep SearchIndexResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchIndexResponse' 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:
--
-- 'thingGroups', 'searchIndexResponse_thingGroups' - The thing groups that match the search query.
--
-- 'nextToken', 'searchIndexResponse_nextToken' - The token used to get the next set of results, or @null@ if there are no
-- additional results.
--
-- 'things', 'searchIndexResponse_things' - The things that match the search query.
--
-- 'httpStatus', 'searchIndexResponse_httpStatus' - The response's http status code.
newSearchIndexResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchIndexResponse
newSearchIndexResponse :: Int -> SearchIndexResponse
newSearchIndexResponse Int
pHttpStatus_ =
  SearchIndexResponse' :: Maybe [ThingGroupDocument]
-> Maybe Text
-> Maybe [ThingDocument]
-> Int
-> SearchIndexResponse
SearchIndexResponse'
    { $sel:thingGroups:SearchIndexResponse' :: Maybe [ThingGroupDocument]
thingGroups = Maybe [ThingGroupDocument]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchIndexResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:things:SearchIndexResponse' :: Maybe [ThingDocument]
things = Maybe [ThingDocument]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchIndexResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The thing groups that match the search query.
searchIndexResponse_thingGroups :: Lens.Lens' SearchIndexResponse (Prelude.Maybe [ThingGroupDocument])
searchIndexResponse_thingGroups :: (Maybe [ThingGroupDocument] -> f (Maybe [ThingGroupDocument]))
-> SearchIndexResponse -> f SearchIndexResponse
searchIndexResponse_thingGroups = (SearchIndexResponse -> Maybe [ThingGroupDocument])
-> (SearchIndexResponse
    -> Maybe [ThingGroupDocument] -> SearchIndexResponse)
-> Lens
     SearchIndexResponse
     SearchIndexResponse
     (Maybe [ThingGroupDocument])
     (Maybe [ThingGroupDocument])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndexResponse' {Maybe [ThingGroupDocument]
thingGroups :: Maybe [ThingGroupDocument]
$sel:thingGroups:SearchIndexResponse' :: SearchIndexResponse -> Maybe [ThingGroupDocument]
thingGroups} -> Maybe [ThingGroupDocument]
thingGroups) (\s :: SearchIndexResponse
s@SearchIndexResponse' {} Maybe [ThingGroupDocument]
a -> SearchIndexResponse
s {$sel:thingGroups:SearchIndexResponse' :: Maybe [ThingGroupDocument]
thingGroups = Maybe [ThingGroupDocument]
a} :: SearchIndexResponse) ((Maybe [ThingGroupDocument] -> f (Maybe [ThingGroupDocument]))
 -> SearchIndexResponse -> f SearchIndexResponse)
-> ((Maybe [ThingGroupDocument] -> f (Maybe [ThingGroupDocument]))
    -> Maybe [ThingGroupDocument] -> f (Maybe [ThingGroupDocument]))
-> (Maybe [ThingGroupDocument] -> f (Maybe [ThingGroupDocument]))
-> SearchIndexResponse
-> f SearchIndexResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ThingGroupDocument]
  [ThingGroupDocument]
  [ThingGroupDocument]
  [ThingGroupDocument]
-> Iso
     (Maybe [ThingGroupDocument])
     (Maybe [ThingGroupDocument])
     (Maybe [ThingGroupDocument])
     (Maybe [ThingGroupDocument])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ThingGroupDocument]
  [ThingGroupDocument]
  [ThingGroupDocument]
  [ThingGroupDocument]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token used to get the next set of results, or @null@ if there are no
-- additional results.
searchIndexResponse_nextToken :: Lens.Lens' SearchIndexResponse (Prelude.Maybe Prelude.Text)
searchIndexResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchIndexResponse -> f SearchIndexResponse
searchIndexResponse_nextToken = (SearchIndexResponse -> Maybe Text)
-> (SearchIndexResponse -> Maybe Text -> SearchIndexResponse)
-> Lens
     SearchIndexResponse SearchIndexResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndexResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchIndexResponse' :: SearchIndexResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchIndexResponse
s@SearchIndexResponse' {} Maybe Text
a -> SearchIndexResponse
s {$sel:nextToken:SearchIndexResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchIndexResponse)

-- | The things that match the search query.
searchIndexResponse_things :: Lens.Lens' SearchIndexResponse (Prelude.Maybe [ThingDocument])
searchIndexResponse_things :: (Maybe [ThingDocument] -> f (Maybe [ThingDocument]))
-> SearchIndexResponse -> f SearchIndexResponse
searchIndexResponse_things = (SearchIndexResponse -> Maybe [ThingDocument])
-> (SearchIndexResponse
    -> Maybe [ThingDocument] -> SearchIndexResponse)
-> Lens
     SearchIndexResponse
     SearchIndexResponse
     (Maybe [ThingDocument])
     (Maybe [ThingDocument])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchIndexResponse' {Maybe [ThingDocument]
things :: Maybe [ThingDocument]
$sel:things:SearchIndexResponse' :: SearchIndexResponse -> Maybe [ThingDocument]
things} -> Maybe [ThingDocument]
things) (\s :: SearchIndexResponse
s@SearchIndexResponse' {} Maybe [ThingDocument]
a -> SearchIndexResponse
s {$sel:things:SearchIndexResponse' :: Maybe [ThingDocument]
things = Maybe [ThingDocument]
a} :: SearchIndexResponse) ((Maybe [ThingDocument] -> f (Maybe [ThingDocument]))
 -> SearchIndexResponse -> f SearchIndexResponse)
-> ((Maybe [ThingDocument] -> f (Maybe [ThingDocument]))
    -> Maybe [ThingDocument] -> f (Maybe [ThingDocument]))
-> (Maybe [ThingDocument] -> f (Maybe [ThingDocument]))
-> SearchIndexResponse
-> f SearchIndexResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ThingDocument] [ThingDocument] [ThingDocument] [ThingDocument]
-> Iso
     (Maybe [ThingDocument])
     (Maybe [ThingDocument])
     (Maybe [ThingDocument])
     (Maybe [ThingDocument])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ThingDocument] [ThingDocument] [ThingDocument] [ThingDocument]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData SearchIndexResponse