{-# 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.Glue.SearchTables
-- 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)
--
-- Searches a set of tables based on properties in the table metadata as
-- well as on the parent database. You can search against text or filter
-- conditions.
--
-- You can only get tables that you have access to based on the security
-- policies defined in Lake Formation. You need at least a read-only access
-- to the table for it to be returned. If you do not have access to all the
-- columns in the table, these columns will not be searched against when
-- returning the list of tables back to you. If you have access to the
-- columns but not the data in the columns, those columns and the
-- associated metadata for those columns will be included in the search.
module Amazonka.Glue.SearchTables
  ( -- * Creating a Request
    SearchTables (..),
    newSearchTables,

    -- * Request Lenses
    searchTables_resourceShareType,
    searchTables_searchText,
    searchTables_filters,
    searchTables_catalogId,
    searchTables_sortCriteria,
    searchTables_nextToken,
    searchTables_maxResults,

    -- * Destructuring the Response
    SearchTablesResponse (..),
    newSearchTablesResponse,

    -- * Response Lenses
    searchTablesResponse_tableList,
    searchTablesResponse_nextToken,
    searchTablesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Glue.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:/ 'newSearchTables' smart constructor.
data SearchTables = SearchTables'
  { -- | Allows you to specify that you want to search the tables shared with
    -- your account. The allowable values are @FOREIGN@ or @ALL@.
    --
    -- -   If set to @FOREIGN@, will search the tables shared with your
    --     account.
    --
    -- -   If set to @ALL@, will search the tables shared with your account, as
    --     well as the tables in yor local account.
    SearchTables -> Maybe ResourceShareType
resourceShareType :: Prelude.Maybe ResourceShareType,
    -- | A string used for a text search.
    --
    -- Specifying a value in quotes filters based on an exact match to the
    -- value.
    SearchTables -> Maybe Text
searchText :: Prelude.Maybe Prelude.Text,
    -- | A list of key-value pairs, and a comparator used to filter the search
    -- results. Returns all entities matching the predicate.
    --
    -- The @Comparator@ member of the @PropertyPredicate@ struct is used only
    -- for time fields, and can be omitted for other field types. Also, when
    -- comparing string values, such as when @Key=Name@, a fuzzy match
    -- algorithm is used. The @Key@ field (for example, the value of the @Name@
    -- field) is split on certain punctuation characters, for example, -, :, #,
    -- etc. into tokens. Then each token is exact-match compared with the
    -- @Value@ member of @PropertyPredicate@. For example, if @Key=Name@ and
    -- @Value=link@, tables named @customer-link@ and @xx-link-yy@ are
    -- returned, but @xxlinkyy@ is not returned.
    SearchTables -> Maybe [PropertyPredicate]
filters :: Prelude.Maybe [PropertyPredicate],
    -- | A unique identifier, consisting of @ account_id @.
    SearchTables -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
    -- | A list of criteria for sorting the results by a field name, in an
    -- ascending or descending order.
    SearchTables -> Maybe [SortCriterion]
sortCriteria :: Prelude.Maybe [SortCriterion],
    -- | A continuation token, included if this is a continuation call.
    SearchTables -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of tables to return in a single response.
    SearchTables -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (SearchTables -> SearchTables -> Bool
(SearchTables -> SearchTables -> Bool)
-> (SearchTables -> SearchTables -> Bool) -> Eq SearchTables
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchTables -> SearchTables -> Bool
$c/= :: SearchTables -> SearchTables -> Bool
== :: SearchTables -> SearchTables -> Bool
$c== :: SearchTables -> SearchTables -> Bool
Prelude.Eq, ReadPrec [SearchTables]
ReadPrec SearchTables
Int -> ReadS SearchTables
ReadS [SearchTables]
(Int -> ReadS SearchTables)
-> ReadS [SearchTables]
-> ReadPrec SearchTables
-> ReadPrec [SearchTables]
-> Read SearchTables
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchTables]
$creadListPrec :: ReadPrec [SearchTables]
readPrec :: ReadPrec SearchTables
$creadPrec :: ReadPrec SearchTables
readList :: ReadS [SearchTables]
$creadList :: ReadS [SearchTables]
readsPrec :: Int -> ReadS SearchTables
$creadsPrec :: Int -> ReadS SearchTables
Prelude.Read, Int -> SearchTables -> ShowS
[SearchTables] -> ShowS
SearchTables -> String
(Int -> SearchTables -> ShowS)
-> (SearchTables -> String)
-> ([SearchTables] -> ShowS)
-> Show SearchTables
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchTables] -> ShowS
$cshowList :: [SearchTables] -> ShowS
show :: SearchTables -> String
$cshow :: SearchTables -> String
showsPrec :: Int -> SearchTables -> ShowS
$cshowsPrec :: Int -> SearchTables -> ShowS
Prelude.Show, (forall x. SearchTables -> Rep SearchTables x)
-> (forall x. Rep SearchTables x -> SearchTables)
-> Generic SearchTables
forall x. Rep SearchTables x -> SearchTables
forall x. SearchTables -> Rep SearchTables x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchTables x -> SearchTables
$cfrom :: forall x. SearchTables -> Rep SearchTables x
Prelude.Generic)

-- |
-- Create a value of 'SearchTables' 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:
--
-- 'resourceShareType', 'searchTables_resourceShareType' - Allows you to specify that you want to search the tables shared with
-- your account. The allowable values are @FOREIGN@ or @ALL@.
--
-- -   If set to @FOREIGN@, will search the tables shared with your
--     account.
--
-- -   If set to @ALL@, will search the tables shared with your account, as
--     well as the tables in yor local account.
--
-- 'searchText', 'searchTables_searchText' - A string used for a text search.
--
-- Specifying a value in quotes filters based on an exact match to the
-- value.
--
-- 'filters', 'searchTables_filters' - A list of key-value pairs, and a comparator used to filter the search
-- results. Returns all entities matching the predicate.
--
-- The @Comparator@ member of the @PropertyPredicate@ struct is used only
-- for time fields, and can be omitted for other field types. Also, when
-- comparing string values, such as when @Key=Name@, a fuzzy match
-- algorithm is used. The @Key@ field (for example, the value of the @Name@
-- field) is split on certain punctuation characters, for example, -, :, #,
-- etc. into tokens. Then each token is exact-match compared with the
-- @Value@ member of @PropertyPredicate@. For example, if @Key=Name@ and
-- @Value=link@, tables named @customer-link@ and @xx-link-yy@ are
-- returned, but @xxlinkyy@ is not returned.
--
-- 'catalogId', 'searchTables_catalogId' - A unique identifier, consisting of @ account_id @.
--
-- 'sortCriteria', 'searchTables_sortCriteria' - A list of criteria for sorting the results by a field name, in an
-- ascending or descending order.
--
-- 'nextToken', 'searchTables_nextToken' - A continuation token, included if this is a continuation call.
--
-- 'maxResults', 'searchTables_maxResults' - The maximum number of tables to return in a single response.
newSearchTables ::
  SearchTables
newSearchTables :: SearchTables
newSearchTables =
  SearchTables' :: Maybe ResourceShareType
-> Maybe Text
-> Maybe [PropertyPredicate]
-> Maybe Text
-> Maybe [SortCriterion]
-> Maybe Text
-> Maybe Natural
-> SearchTables
SearchTables'
    { $sel:resourceShareType:SearchTables' :: Maybe ResourceShareType
resourceShareType = Maybe ResourceShareType
forall a. Maybe a
Prelude.Nothing,
      $sel:searchText:SearchTables' :: Maybe Text
searchText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:SearchTables' :: Maybe [PropertyPredicate]
filters = Maybe [PropertyPredicate]
forall a. Maybe a
Prelude.Nothing,
      $sel:catalogId:SearchTables' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchTables' :: Maybe [SortCriterion]
sortCriteria = Maybe [SortCriterion]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchTables' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchTables' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Allows you to specify that you want to search the tables shared with
-- your account. The allowable values are @FOREIGN@ or @ALL@.
--
-- -   If set to @FOREIGN@, will search the tables shared with your
--     account.
--
-- -   If set to @ALL@, will search the tables shared with your account, as
--     well as the tables in yor local account.
searchTables_resourceShareType :: Lens.Lens' SearchTables (Prelude.Maybe ResourceShareType)
searchTables_resourceShareType :: (Maybe ResourceShareType -> f (Maybe ResourceShareType))
-> SearchTables -> f SearchTables
searchTables_resourceShareType = (SearchTables -> Maybe ResourceShareType)
-> (SearchTables -> Maybe ResourceShareType -> SearchTables)
-> Lens
     SearchTables
     SearchTables
     (Maybe ResourceShareType)
     (Maybe ResourceShareType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTables' {Maybe ResourceShareType
resourceShareType :: Maybe ResourceShareType
$sel:resourceShareType:SearchTables' :: SearchTables -> Maybe ResourceShareType
resourceShareType} -> Maybe ResourceShareType
resourceShareType) (\s :: SearchTables
s@SearchTables' {} Maybe ResourceShareType
a -> SearchTables
s {$sel:resourceShareType:SearchTables' :: Maybe ResourceShareType
resourceShareType = Maybe ResourceShareType
a} :: SearchTables)

-- | A string used for a text search.
--
-- Specifying a value in quotes filters based on an exact match to the
-- value.
searchTables_searchText :: Lens.Lens' SearchTables (Prelude.Maybe Prelude.Text)
searchTables_searchText :: (Maybe Text -> f (Maybe Text)) -> SearchTables -> f SearchTables
searchTables_searchText = (SearchTables -> Maybe Text)
-> (SearchTables -> Maybe Text -> SearchTables)
-> Lens SearchTables SearchTables (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTables' {Maybe Text
searchText :: Maybe Text
$sel:searchText:SearchTables' :: SearchTables -> Maybe Text
searchText} -> Maybe Text
searchText) (\s :: SearchTables
s@SearchTables' {} Maybe Text
a -> SearchTables
s {$sel:searchText:SearchTables' :: Maybe Text
searchText = Maybe Text
a} :: SearchTables)

-- | A list of key-value pairs, and a comparator used to filter the search
-- results. Returns all entities matching the predicate.
--
-- The @Comparator@ member of the @PropertyPredicate@ struct is used only
-- for time fields, and can be omitted for other field types. Also, when
-- comparing string values, such as when @Key=Name@, a fuzzy match
-- algorithm is used. The @Key@ field (for example, the value of the @Name@
-- field) is split on certain punctuation characters, for example, -, :, #,
-- etc. into tokens. Then each token is exact-match compared with the
-- @Value@ member of @PropertyPredicate@. For example, if @Key=Name@ and
-- @Value=link@, tables named @customer-link@ and @xx-link-yy@ are
-- returned, but @xxlinkyy@ is not returned.
searchTables_filters :: Lens.Lens' SearchTables (Prelude.Maybe [PropertyPredicate])
searchTables_filters :: (Maybe [PropertyPredicate] -> f (Maybe [PropertyPredicate]))
-> SearchTables -> f SearchTables
searchTables_filters = (SearchTables -> Maybe [PropertyPredicate])
-> (SearchTables -> Maybe [PropertyPredicate] -> SearchTables)
-> Lens
     SearchTables
     SearchTables
     (Maybe [PropertyPredicate])
     (Maybe [PropertyPredicate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTables' {Maybe [PropertyPredicate]
filters :: Maybe [PropertyPredicate]
$sel:filters:SearchTables' :: SearchTables -> Maybe [PropertyPredicate]
filters} -> Maybe [PropertyPredicate]
filters) (\s :: SearchTables
s@SearchTables' {} Maybe [PropertyPredicate]
a -> SearchTables
s {$sel:filters:SearchTables' :: Maybe [PropertyPredicate]
filters = Maybe [PropertyPredicate]
a} :: SearchTables) ((Maybe [PropertyPredicate] -> f (Maybe [PropertyPredicate]))
 -> SearchTables -> f SearchTables)
-> ((Maybe [PropertyPredicate] -> f (Maybe [PropertyPredicate]))
    -> Maybe [PropertyPredicate] -> f (Maybe [PropertyPredicate]))
-> (Maybe [PropertyPredicate] -> f (Maybe [PropertyPredicate]))
-> SearchTables
-> f SearchTables
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PropertyPredicate]
  [PropertyPredicate]
  [PropertyPredicate]
  [PropertyPredicate]
-> Iso
     (Maybe [PropertyPredicate])
     (Maybe [PropertyPredicate])
     (Maybe [PropertyPredicate])
     (Maybe [PropertyPredicate])
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
  [PropertyPredicate]
  [PropertyPredicate]
  [PropertyPredicate]
  [PropertyPredicate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique identifier, consisting of @ account_id @.
searchTables_catalogId :: Lens.Lens' SearchTables (Prelude.Maybe Prelude.Text)
searchTables_catalogId :: (Maybe Text -> f (Maybe Text)) -> SearchTables -> f SearchTables
searchTables_catalogId = (SearchTables -> Maybe Text)
-> (SearchTables -> Maybe Text -> SearchTables)
-> Lens SearchTables SearchTables (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTables' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:SearchTables' :: SearchTables -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: SearchTables
s@SearchTables' {} Maybe Text
a -> SearchTables
s {$sel:catalogId:SearchTables' :: Maybe Text
catalogId = Maybe Text
a} :: SearchTables)

-- | A list of criteria for sorting the results by a field name, in an
-- ascending or descending order.
searchTables_sortCriteria :: Lens.Lens' SearchTables (Prelude.Maybe [SortCriterion])
searchTables_sortCriteria :: (Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
-> SearchTables -> f SearchTables
searchTables_sortCriteria = (SearchTables -> Maybe [SortCriterion])
-> (SearchTables -> Maybe [SortCriterion] -> SearchTables)
-> Lens
     SearchTables
     SearchTables
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTables' {Maybe [SortCriterion]
sortCriteria :: Maybe [SortCriterion]
$sel:sortCriteria:SearchTables' :: SearchTables -> Maybe [SortCriterion]
sortCriteria} -> Maybe [SortCriterion]
sortCriteria) (\s :: SearchTables
s@SearchTables' {} Maybe [SortCriterion]
a -> SearchTables
s {$sel:sortCriteria:SearchTables' :: Maybe [SortCriterion]
sortCriteria = Maybe [SortCriterion]
a} :: SearchTables) ((Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
 -> SearchTables -> f SearchTables)
-> ((Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
    -> Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
-> (Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
-> SearchTables
-> f SearchTables
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SortCriterion] [SortCriterion] [SortCriterion] [SortCriterion]
-> Iso
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
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
  [SortCriterion] [SortCriterion] [SortCriterion] [SortCriterion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A continuation token, included if this is a continuation call.
searchTables_nextToken :: Lens.Lens' SearchTables (Prelude.Maybe Prelude.Text)
searchTables_nextToken :: (Maybe Text -> f (Maybe Text)) -> SearchTables -> f SearchTables
searchTables_nextToken = (SearchTables -> Maybe Text)
-> (SearchTables -> Maybe Text -> SearchTables)
-> Lens SearchTables SearchTables (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTables' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchTables' :: SearchTables -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchTables
s@SearchTables' {} Maybe Text
a -> SearchTables
s {$sel:nextToken:SearchTables' :: Maybe Text
nextToken = Maybe Text
a} :: SearchTables)

-- | The maximum number of tables to return in a single response.
searchTables_maxResults :: Lens.Lens' SearchTables (Prelude.Maybe Prelude.Natural)
searchTables_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchTables -> f SearchTables
searchTables_maxResults = (SearchTables -> Maybe Natural)
-> (SearchTables -> Maybe Natural -> SearchTables)
-> Lens SearchTables SearchTables (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTables' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchTables' :: SearchTables -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchTables
s@SearchTables' {} Maybe Natural
a -> SearchTables
s {$sel:maxResults:SearchTables' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchTables)

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

instance Prelude.NFData SearchTables

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

instance Core.ToJSON SearchTables where
  toJSON :: SearchTables -> Value
toJSON SearchTables' {Maybe Natural
Maybe [PropertyPredicate]
Maybe [SortCriterion]
Maybe Text
Maybe ResourceShareType
maxResults :: Maybe Natural
nextToken :: Maybe Text
sortCriteria :: Maybe [SortCriterion]
catalogId :: Maybe Text
filters :: Maybe [PropertyPredicate]
searchText :: Maybe Text
resourceShareType :: Maybe ResourceShareType
$sel:maxResults:SearchTables' :: SearchTables -> Maybe Natural
$sel:nextToken:SearchTables' :: SearchTables -> Maybe Text
$sel:sortCriteria:SearchTables' :: SearchTables -> Maybe [SortCriterion]
$sel:catalogId:SearchTables' :: SearchTables -> Maybe Text
$sel:filters:SearchTables' :: SearchTables -> Maybe [PropertyPredicate]
$sel:searchText:SearchTables' :: SearchTables -> Maybe Text
$sel:resourceShareType:SearchTables' :: SearchTables -> Maybe ResourceShareType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ResourceShareType" Text -> ResourceShareType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ResourceShareType -> Pair)
-> Maybe ResourceShareType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceShareType
resourceShareType,
            (Text
"SearchText" 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
searchText,
            (Text
"Filters" Text -> [PropertyPredicate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([PropertyPredicate] -> Pair)
-> Maybe [PropertyPredicate] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PropertyPredicate]
filters,
            (Text
"CatalogId" 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
catalogId,
            (Text
"SortCriteria" Text -> [SortCriterion] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([SortCriterion] -> Pair) -> Maybe [SortCriterion] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SortCriterion]
sortCriteria,
            (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
          ]
      )

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

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

-- | /See:/ 'newSearchTablesResponse' smart constructor.
data SearchTablesResponse = SearchTablesResponse'
  { -- | A list of the requested @Table@ objects. The @SearchTables@ response
    -- returns only the tables that you have access to.
    SearchTablesResponse -> Maybe [Table]
tableList :: Prelude.Maybe [Table],
    -- | A continuation token, present if the current list segment is not the
    -- last.
    SearchTablesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    SearchTablesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchTablesResponse -> SearchTablesResponse -> Bool
(SearchTablesResponse -> SearchTablesResponse -> Bool)
-> (SearchTablesResponse -> SearchTablesResponse -> Bool)
-> Eq SearchTablesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchTablesResponse -> SearchTablesResponse -> Bool
$c/= :: SearchTablesResponse -> SearchTablesResponse -> Bool
== :: SearchTablesResponse -> SearchTablesResponse -> Bool
$c== :: SearchTablesResponse -> SearchTablesResponse -> Bool
Prelude.Eq, ReadPrec [SearchTablesResponse]
ReadPrec SearchTablesResponse
Int -> ReadS SearchTablesResponse
ReadS [SearchTablesResponse]
(Int -> ReadS SearchTablesResponse)
-> ReadS [SearchTablesResponse]
-> ReadPrec SearchTablesResponse
-> ReadPrec [SearchTablesResponse]
-> Read SearchTablesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchTablesResponse]
$creadListPrec :: ReadPrec [SearchTablesResponse]
readPrec :: ReadPrec SearchTablesResponse
$creadPrec :: ReadPrec SearchTablesResponse
readList :: ReadS [SearchTablesResponse]
$creadList :: ReadS [SearchTablesResponse]
readsPrec :: Int -> ReadS SearchTablesResponse
$creadsPrec :: Int -> ReadS SearchTablesResponse
Prelude.Read, Int -> SearchTablesResponse -> ShowS
[SearchTablesResponse] -> ShowS
SearchTablesResponse -> String
(Int -> SearchTablesResponse -> ShowS)
-> (SearchTablesResponse -> String)
-> ([SearchTablesResponse] -> ShowS)
-> Show SearchTablesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchTablesResponse] -> ShowS
$cshowList :: [SearchTablesResponse] -> ShowS
show :: SearchTablesResponse -> String
$cshow :: SearchTablesResponse -> String
showsPrec :: Int -> SearchTablesResponse -> ShowS
$cshowsPrec :: Int -> SearchTablesResponse -> ShowS
Prelude.Show, (forall x. SearchTablesResponse -> Rep SearchTablesResponse x)
-> (forall x. Rep SearchTablesResponse x -> SearchTablesResponse)
-> Generic SearchTablesResponse
forall x. Rep SearchTablesResponse x -> SearchTablesResponse
forall x. SearchTablesResponse -> Rep SearchTablesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchTablesResponse x -> SearchTablesResponse
$cfrom :: forall x. SearchTablesResponse -> Rep SearchTablesResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchTablesResponse' 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:
--
-- 'tableList', 'searchTablesResponse_tableList' - A list of the requested @Table@ objects. The @SearchTables@ response
-- returns only the tables that you have access to.
--
-- 'nextToken', 'searchTablesResponse_nextToken' - A continuation token, present if the current list segment is not the
-- last.
--
-- 'httpStatus', 'searchTablesResponse_httpStatus' - The response's http status code.
newSearchTablesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchTablesResponse
newSearchTablesResponse :: Int -> SearchTablesResponse
newSearchTablesResponse Int
pHttpStatus_ =
  SearchTablesResponse' :: Maybe [Table] -> Maybe Text -> Int -> SearchTablesResponse
SearchTablesResponse'
    { $sel:tableList:SearchTablesResponse' :: Maybe [Table]
tableList = Maybe [Table]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchTablesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchTablesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of the requested @Table@ objects. The @SearchTables@ response
-- returns only the tables that you have access to.
searchTablesResponse_tableList :: Lens.Lens' SearchTablesResponse (Prelude.Maybe [Table])
searchTablesResponse_tableList :: (Maybe [Table] -> f (Maybe [Table]))
-> SearchTablesResponse -> f SearchTablesResponse
searchTablesResponse_tableList = (SearchTablesResponse -> Maybe [Table])
-> (SearchTablesResponse -> Maybe [Table] -> SearchTablesResponse)
-> Lens
     SearchTablesResponse
     SearchTablesResponse
     (Maybe [Table])
     (Maybe [Table])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTablesResponse' {Maybe [Table]
tableList :: Maybe [Table]
$sel:tableList:SearchTablesResponse' :: SearchTablesResponse -> Maybe [Table]
tableList} -> Maybe [Table]
tableList) (\s :: SearchTablesResponse
s@SearchTablesResponse' {} Maybe [Table]
a -> SearchTablesResponse
s {$sel:tableList:SearchTablesResponse' :: Maybe [Table]
tableList = Maybe [Table]
a} :: SearchTablesResponse) ((Maybe [Table] -> f (Maybe [Table]))
 -> SearchTablesResponse -> f SearchTablesResponse)
-> ((Maybe [Table] -> f (Maybe [Table]))
    -> Maybe [Table] -> f (Maybe [Table]))
-> (Maybe [Table] -> f (Maybe [Table]))
-> SearchTablesResponse
-> f SearchTablesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Table] [Table] [Table] [Table]
-> Iso
     (Maybe [Table]) (Maybe [Table]) (Maybe [Table]) (Maybe [Table])
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 [Table] [Table] [Table] [Table]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A continuation token, present if the current list segment is not the
-- last.
searchTablesResponse_nextToken :: Lens.Lens' SearchTablesResponse (Prelude.Maybe Prelude.Text)
searchTablesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchTablesResponse -> f SearchTablesResponse
searchTablesResponse_nextToken = (SearchTablesResponse -> Maybe Text)
-> (SearchTablesResponse -> Maybe Text -> SearchTablesResponse)
-> Lens
     SearchTablesResponse SearchTablesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchTablesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchTablesResponse' :: SearchTablesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchTablesResponse
s@SearchTablesResponse' {} Maybe Text
a -> SearchTablesResponse
s {$sel:nextToken:SearchTablesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchTablesResponse)

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

instance Prelude.NFData SearchTablesResponse