{-# 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.GetUserDefinedFunctions
-- 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)
--
-- Retrieves multiple function definitions from the Data Catalog.
--
-- This operation returns paginated results.
module Amazonka.Glue.GetUserDefinedFunctions
  ( -- * Creating a Request
    GetUserDefinedFunctions (..),
    newGetUserDefinedFunctions,

    -- * Request Lenses
    getUserDefinedFunctions_catalogId,
    getUserDefinedFunctions_nextToken,
    getUserDefinedFunctions_databaseName,
    getUserDefinedFunctions_maxResults,
    getUserDefinedFunctions_pattern,

    -- * Destructuring the Response
    GetUserDefinedFunctionsResponse (..),
    newGetUserDefinedFunctionsResponse,

    -- * Response Lenses
    getUserDefinedFunctionsResponse_nextToken,
    getUserDefinedFunctionsResponse_userDefinedFunctions,
    getUserDefinedFunctionsResponse_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:/ 'newGetUserDefinedFunctions' smart constructor.
data GetUserDefinedFunctions = GetUserDefinedFunctions'
  { -- | The ID of the Data Catalog where the functions to be retrieved are
    -- located. If none is provided, the Amazon Web Services account ID is used
    -- by default.
    GetUserDefinedFunctions -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
    -- | A continuation token, if this is a continuation call.
    GetUserDefinedFunctions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the catalog database where the functions are located. If
    -- none is provided, functions from all the databases across the catalog
    -- will be returned.
    GetUserDefinedFunctions -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of functions to return in one response.
    GetUserDefinedFunctions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | An optional function-name pattern string that filters the function
    -- definitions returned.
    GetUserDefinedFunctions -> Text
pattern' :: Prelude.Text
  }
  deriving (GetUserDefinedFunctions -> GetUserDefinedFunctions -> Bool
(GetUserDefinedFunctions -> GetUserDefinedFunctions -> Bool)
-> (GetUserDefinedFunctions -> GetUserDefinedFunctions -> Bool)
-> Eq GetUserDefinedFunctions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUserDefinedFunctions -> GetUserDefinedFunctions -> Bool
$c/= :: GetUserDefinedFunctions -> GetUserDefinedFunctions -> Bool
== :: GetUserDefinedFunctions -> GetUserDefinedFunctions -> Bool
$c== :: GetUserDefinedFunctions -> GetUserDefinedFunctions -> Bool
Prelude.Eq, ReadPrec [GetUserDefinedFunctions]
ReadPrec GetUserDefinedFunctions
Int -> ReadS GetUserDefinedFunctions
ReadS [GetUserDefinedFunctions]
(Int -> ReadS GetUserDefinedFunctions)
-> ReadS [GetUserDefinedFunctions]
-> ReadPrec GetUserDefinedFunctions
-> ReadPrec [GetUserDefinedFunctions]
-> Read GetUserDefinedFunctions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUserDefinedFunctions]
$creadListPrec :: ReadPrec [GetUserDefinedFunctions]
readPrec :: ReadPrec GetUserDefinedFunctions
$creadPrec :: ReadPrec GetUserDefinedFunctions
readList :: ReadS [GetUserDefinedFunctions]
$creadList :: ReadS [GetUserDefinedFunctions]
readsPrec :: Int -> ReadS GetUserDefinedFunctions
$creadsPrec :: Int -> ReadS GetUserDefinedFunctions
Prelude.Read, Int -> GetUserDefinedFunctions -> ShowS
[GetUserDefinedFunctions] -> ShowS
GetUserDefinedFunctions -> String
(Int -> GetUserDefinedFunctions -> ShowS)
-> (GetUserDefinedFunctions -> String)
-> ([GetUserDefinedFunctions] -> ShowS)
-> Show GetUserDefinedFunctions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUserDefinedFunctions] -> ShowS
$cshowList :: [GetUserDefinedFunctions] -> ShowS
show :: GetUserDefinedFunctions -> String
$cshow :: GetUserDefinedFunctions -> String
showsPrec :: Int -> GetUserDefinedFunctions -> ShowS
$cshowsPrec :: Int -> GetUserDefinedFunctions -> ShowS
Prelude.Show, (forall x.
 GetUserDefinedFunctions -> Rep GetUserDefinedFunctions x)
-> (forall x.
    Rep GetUserDefinedFunctions x -> GetUserDefinedFunctions)
-> Generic GetUserDefinedFunctions
forall x. Rep GetUserDefinedFunctions x -> GetUserDefinedFunctions
forall x. GetUserDefinedFunctions -> Rep GetUserDefinedFunctions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUserDefinedFunctions x -> GetUserDefinedFunctions
$cfrom :: forall x. GetUserDefinedFunctions -> Rep GetUserDefinedFunctions x
Prelude.Generic)

-- |
-- Create a value of 'GetUserDefinedFunctions' 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:
--
-- 'catalogId', 'getUserDefinedFunctions_catalogId' - The ID of the Data Catalog where the functions to be retrieved are
-- located. If none is provided, the Amazon Web Services account ID is used
-- by default.
--
-- 'nextToken', 'getUserDefinedFunctions_nextToken' - A continuation token, if this is a continuation call.
--
-- 'databaseName', 'getUserDefinedFunctions_databaseName' - The name of the catalog database where the functions are located. If
-- none is provided, functions from all the databases across the catalog
-- will be returned.
--
-- 'maxResults', 'getUserDefinedFunctions_maxResults' - The maximum number of functions to return in one response.
--
-- 'pattern'', 'getUserDefinedFunctions_pattern' - An optional function-name pattern string that filters the function
-- definitions returned.
newGetUserDefinedFunctions ::
  -- | 'pattern''
  Prelude.Text ->
  GetUserDefinedFunctions
newGetUserDefinedFunctions :: Text -> GetUserDefinedFunctions
newGetUserDefinedFunctions Text
pPattern_ =
  GetUserDefinedFunctions' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Text
-> GetUserDefinedFunctions
GetUserDefinedFunctions'
    { $sel:catalogId:GetUserDefinedFunctions' :: Maybe Text
catalogId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetUserDefinedFunctions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:databaseName:GetUserDefinedFunctions' :: Maybe Text
databaseName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetUserDefinedFunctions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:pattern':GetUserDefinedFunctions' :: Text
pattern' = Text
pPattern_
    }

-- | The ID of the Data Catalog where the functions to be retrieved are
-- located. If none is provided, the Amazon Web Services account ID is used
-- by default.
getUserDefinedFunctions_catalogId :: Lens.Lens' GetUserDefinedFunctions (Prelude.Maybe Prelude.Text)
getUserDefinedFunctions_catalogId :: (Maybe Text -> f (Maybe Text))
-> GetUserDefinedFunctions -> f GetUserDefinedFunctions
getUserDefinedFunctions_catalogId = (GetUserDefinedFunctions -> Maybe Text)
-> (GetUserDefinedFunctions
    -> Maybe Text -> GetUserDefinedFunctions)
-> Lens
     GetUserDefinedFunctions
     GetUserDefinedFunctions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunctions' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetUserDefinedFunctions
s@GetUserDefinedFunctions' {} Maybe Text
a -> GetUserDefinedFunctions
s {$sel:catalogId:GetUserDefinedFunctions' :: Maybe Text
catalogId = Maybe Text
a} :: GetUserDefinedFunctions)

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

-- | The name of the catalog database where the functions are located. If
-- none is provided, functions from all the databases across the catalog
-- will be returned.
getUserDefinedFunctions_databaseName :: Lens.Lens' GetUserDefinedFunctions (Prelude.Maybe Prelude.Text)
getUserDefinedFunctions_databaseName :: (Maybe Text -> f (Maybe Text))
-> GetUserDefinedFunctions -> f GetUserDefinedFunctions
getUserDefinedFunctions_databaseName = (GetUserDefinedFunctions -> Maybe Text)
-> (GetUserDefinedFunctions
    -> Maybe Text -> GetUserDefinedFunctions)
-> Lens
     GetUserDefinedFunctions
     GetUserDefinedFunctions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunctions' {Maybe Text
databaseName :: Maybe Text
$sel:databaseName:GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Maybe Text
databaseName} -> Maybe Text
databaseName) (\s :: GetUserDefinedFunctions
s@GetUserDefinedFunctions' {} Maybe Text
a -> GetUserDefinedFunctions
s {$sel:databaseName:GetUserDefinedFunctions' :: Maybe Text
databaseName = Maybe Text
a} :: GetUserDefinedFunctions)

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

-- | An optional function-name pattern string that filters the function
-- definitions returned.
getUserDefinedFunctions_pattern :: Lens.Lens' GetUserDefinedFunctions Prelude.Text
getUserDefinedFunctions_pattern :: (Text -> f Text)
-> GetUserDefinedFunctions -> f GetUserDefinedFunctions
getUserDefinedFunctions_pattern = (GetUserDefinedFunctions -> Text)
-> (GetUserDefinedFunctions -> Text -> GetUserDefinedFunctions)
-> Lens GetUserDefinedFunctions GetUserDefinedFunctions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunctions' {Text
pattern' :: Text
$sel:pattern':GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Text
pattern'} -> Text
pattern') (\s :: GetUserDefinedFunctions
s@GetUserDefinedFunctions' {} Text
a -> GetUserDefinedFunctions
s {$sel:pattern':GetUserDefinedFunctions' :: Text
pattern' = Text
a} :: GetUserDefinedFunctions)

instance Core.AWSPager GetUserDefinedFunctions where
  page :: GetUserDefinedFunctions
-> AWSResponse GetUserDefinedFunctions
-> Maybe GetUserDefinedFunctions
page GetUserDefinedFunctions
rq AWSResponse GetUserDefinedFunctions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetUserDefinedFunctions
GetUserDefinedFunctionsResponse
rs
            GetUserDefinedFunctionsResponse
-> Getting (First Text) GetUserDefinedFunctionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetUserDefinedFunctionsResponse
-> Const (First Text) GetUserDefinedFunctionsResponse
Lens' GetUserDefinedFunctionsResponse (Maybe Text)
getUserDefinedFunctionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetUserDefinedFunctionsResponse
 -> Const (First Text) GetUserDefinedFunctionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetUserDefinedFunctionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetUserDefinedFunctions
forall a. Maybe a
Prelude.Nothing
    | Maybe [UserDefinedFunction] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetUserDefinedFunctions
GetUserDefinedFunctionsResponse
rs
            GetUserDefinedFunctionsResponse
-> Getting
     (First [UserDefinedFunction])
     GetUserDefinedFunctionsResponse
     [UserDefinedFunction]
-> Maybe [UserDefinedFunction]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [UserDefinedFunction]
 -> Const
      (First [UserDefinedFunction]) (Maybe [UserDefinedFunction]))
-> GetUserDefinedFunctionsResponse
-> Const
     (First [UserDefinedFunction]) GetUserDefinedFunctionsResponse
Lens' GetUserDefinedFunctionsResponse (Maybe [UserDefinedFunction])
getUserDefinedFunctionsResponse_userDefinedFunctions
              ((Maybe [UserDefinedFunction]
  -> Const
       (First [UserDefinedFunction]) (Maybe [UserDefinedFunction]))
 -> GetUserDefinedFunctionsResponse
 -> Const
      (First [UserDefinedFunction]) GetUserDefinedFunctionsResponse)
-> (([UserDefinedFunction]
     -> Const (First [UserDefinedFunction]) [UserDefinedFunction])
    -> Maybe [UserDefinedFunction]
    -> Const
         (First [UserDefinedFunction]) (Maybe [UserDefinedFunction]))
-> Getting
     (First [UserDefinedFunction])
     GetUserDefinedFunctionsResponse
     [UserDefinedFunction]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UserDefinedFunction]
 -> Const (First [UserDefinedFunction]) [UserDefinedFunction])
-> Maybe [UserDefinedFunction]
-> Const
     (First [UserDefinedFunction]) (Maybe [UserDefinedFunction])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetUserDefinedFunctions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetUserDefinedFunctions -> Maybe GetUserDefinedFunctions
forall a. a -> Maybe a
Prelude.Just (GetUserDefinedFunctions -> Maybe GetUserDefinedFunctions)
-> GetUserDefinedFunctions -> Maybe GetUserDefinedFunctions
forall a b. (a -> b) -> a -> b
Prelude.$
        GetUserDefinedFunctions
rq
          GetUserDefinedFunctions
-> (GetUserDefinedFunctions -> GetUserDefinedFunctions)
-> GetUserDefinedFunctions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetUserDefinedFunctions -> Identity GetUserDefinedFunctions
Lens
  GetUserDefinedFunctions
  GetUserDefinedFunctions
  (Maybe Text)
  (Maybe Text)
getUserDefinedFunctions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetUserDefinedFunctions -> Identity GetUserDefinedFunctions)
-> Maybe Text -> GetUserDefinedFunctions -> GetUserDefinedFunctions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetUserDefinedFunctions
GetUserDefinedFunctionsResponse
rs
          GetUserDefinedFunctionsResponse
-> Getting (First Text) GetUserDefinedFunctionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetUserDefinedFunctionsResponse
-> Const (First Text) GetUserDefinedFunctionsResponse
Lens' GetUserDefinedFunctionsResponse (Maybe Text)
getUserDefinedFunctionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetUserDefinedFunctionsResponse
 -> Const (First Text) GetUserDefinedFunctionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetUserDefinedFunctionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance Prelude.NFData GetUserDefinedFunctions

instance Core.ToHeaders GetUserDefinedFunctions where
  toHeaders :: GetUserDefinedFunctions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetUserDefinedFunctions -> 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.GetUserDefinedFunctions" ::
                          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 GetUserDefinedFunctions where
  toJSON :: GetUserDefinedFunctions -> Value
toJSON GetUserDefinedFunctions' {Maybe Natural
Maybe Text
Text
pattern' :: Text
maxResults :: Maybe Natural
databaseName :: Maybe Text
nextToken :: Maybe Text
catalogId :: Maybe Text
$sel:pattern':GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Text
$sel:maxResults:GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Maybe Natural
$sel:databaseName:GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Maybe Text
$sel:nextToken:GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Maybe Text
$sel:catalogId:GetUserDefinedFunctions' :: GetUserDefinedFunctions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"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
"DatabaseName" 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
databaseName,
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Pattern" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pattern')
          ]
      )

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

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

-- | /See:/ 'newGetUserDefinedFunctionsResponse' smart constructor.
data GetUserDefinedFunctionsResponse = GetUserDefinedFunctionsResponse'
  { -- | A continuation token, if the list of functions returned does not include
    -- the last requested function.
    GetUserDefinedFunctionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of requested function definitions.
    GetUserDefinedFunctionsResponse -> Maybe [UserDefinedFunction]
userDefinedFunctions :: Prelude.Maybe [UserDefinedFunction],
    -- | The response's http status code.
    GetUserDefinedFunctionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetUserDefinedFunctionsResponse
-> GetUserDefinedFunctionsResponse -> Bool
(GetUserDefinedFunctionsResponse
 -> GetUserDefinedFunctionsResponse -> Bool)
-> (GetUserDefinedFunctionsResponse
    -> GetUserDefinedFunctionsResponse -> Bool)
-> Eq GetUserDefinedFunctionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUserDefinedFunctionsResponse
-> GetUserDefinedFunctionsResponse -> Bool
$c/= :: GetUserDefinedFunctionsResponse
-> GetUserDefinedFunctionsResponse -> Bool
== :: GetUserDefinedFunctionsResponse
-> GetUserDefinedFunctionsResponse -> Bool
$c== :: GetUserDefinedFunctionsResponse
-> GetUserDefinedFunctionsResponse -> Bool
Prelude.Eq, ReadPrec [GetUserDefinedFunctionsResponse]
ReadPrec GetUserDefinedFunctionsResponse
Int -> ReadS GetUserDefinedFunctionsResponse
ReadS [GetUserDefinedFunctionsResponse]
(Int -> ReadS GetUserDefinedFunctionsResponse)
-> ReadS [GetUserDefinedFunctionsResponse]
-> ReadPrec GetUserDefinedFunctionsResponse
-> ReadPrec [GetUserDefinedFunctionsResponse]
-> Read GetUserDefinedFunctionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUserDefinedFunctionsResponse]
$creadListPrec :: ReadPrec [GetUserDefinedFunctionsResponse]
readPrec :: ReadPrec GetUserDefinedFunctionsResponse
$creadPrec :: ReadPrec GetUserDefinedFunctionsResponse
readList :: ReadS [GetUserDefinedFunctionsResponse]
$creadList :: ReadS [GetUserDefinedFunctionsResponse]
readsPrec :: Int -> ReadS GetUserDefinedFunctionsResponse
$creadsPrec :: Int -> ReadS GetUserDefinedFunctionsResponse
Prelude.Read, Int -> GetUserDefinedFunctionsResponse -> ShowS
[GetUserDefinedFunctionsResponse] -> ShowS
GetUserDefinedFunctionsResponse -> String
(Int -> GetUserDefinedFunctionsResponse -> ShowS)
-> (GetUserDefinedFunctionsResponse -> String)
-> ([GetUserDefinedFunctionsResponse] -> ShowS)
-> Show GetUserDefinedFunctionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUserDefinedFunctionsResponse] -> ShowS
$cshowList :: [GetUserDefinedFunctionsResponse] -> ShowS
show :: GetUserDefinedFunctionsResponse -> String
$cshow :: GetUserDefinedFunctionsResponse -> String
showsPrec :: Int -> GetUserDefinedFunctionsResponse -> ShowS
$cshowsPrec :: Int -> GetUserDefinedFunctionsResponse -> ShowS
Prelude.Show, (forall x.
 GetUserDefinedFunctionsResponse
 -> Rep GetUserDefinedFunctionsResponse x)
-> (forall x.
    Rep GetUserDefinedFunctionsResponse x
    -> GetUserDefinedFunctionsResponse)
-> Generic GetUserDefinedFunctionsResponse
forall x.
Rep GetUserDefinedFunctionsResponse x
-> GetUserDefinedFunctionsResponse
forall x.
GetUserDefinedFunctionsResponse
-> Rep GetUserDefinedFunctionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetUserDefinedFunctionsResponse x
-> GetUserDefinedFunctionsResponse
$cfrom :: forall x.
GetUserDefinedFunctionsResponse
-> Rep GetUserDefinedFunctionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetUserDefinedFunctionsResponse' 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:
--
-- 'nextToken', 'getUserDefinedFunctionsResponse_nextToken' - A continuation token, if the list of functions returned does not include
-- the last requested function.
--
-- 'userDefinedFunctions', 'getUserDefinedFunctionsResponse_userDefinedFunctions' - A list of requested function definitions.
--
-- 'httpStatus', 'getUserDefinedFunctionsResponse_httpStatus' - The response's http status code.
newGetUserDefinedFunctionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetUserDefinedFunctionsResponse
newGetUserDefinedFunctionsResponse :: Int -> GetUserDefinedFunctionsResponse
newGetUserDefinedFunctionsResponse Int
pHttpStatus_ =
  GetUserDefinedFunctionsResponse' :: Maybe Text
-> Maybe [UserDefinedFunction]
-> Int
-> GetUserDefinedFunctionsResponse
GetUserDefinedFunctionsResponse'
    { $sel:nextToken:GetUserDefinedFunctionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userDefinedFunctions:GetUserDefinedFunctionsResponse' :: Maybe [UserDefinedFunction]
userDefinedFunctions = Maybe [UserDefinedFunction]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetUserDefinedFunctionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A continuation token, if the list of functions returned does not include
-- the last requested function.
getUserDefinedFunctionsResponse_nextToken :: Lens.Lens' GetUserDefinedFunctionsResponse (Prelude.Maybe Prelude.Text)
getUserDefinedFunctionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetUserDefinedFunctionsResponse
-> f GetUserDefinedFunctionsResponse
getUserDefinedFunctionsResponse_nextToken = (GetUserDefinedFunctionsResponse -> Maybe Text)
-> (GetUserDefinedFunctionsResponse
    -> Maybe Text -> GetUserDefinedFunctionsResponse)
-> Lens' GetUserDefinedFunctionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunctionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetUserDefinedFunctionsResponse' :: GetUserDefinedFunctionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetUserDefinedFunctionsResponse
s@GetUserDefinedFunctionsResponse' {} Maybe Text
a -> GetUserDefinedFunctionsResponse
s {$sel:nextToken:GetUserDefinedFunctionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetUserDefinedFunctionsResponse)

-- | A list of requested function definitions.
getUserDefinedFunctionsResponse_userDefinedFunctions :: Lens.Lens' GetUserDefinedFunctionsResponse (Prelude.Maybe [UserDefinedFunction])
getUserDefinedFunctionsResponse_userDefinedFunctions :: (Maybe [UserDefinedFunction] -> f (Maybe [UserDefinedFunction]))
-> GetUserDefinedFunctionsResponse
-> f GetUserDefinedFunctionsResponse
getUserDefinedFunctionsResponse_userDefinedFunctions = (GetUserDefinedFunctionsResponse -> Maybe [UserDefinedFunction])
-> (GetUserDefinedFunctionsResponse
    -> Maybe [UserDefinedFunction] -> GetUserDefinedFunctionsResponse)
-> Lens'
     GetUserDefinedFunctionsResponse (Maybe [UserDefinedFunction])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunctionsResponse' {Maybe [UserDefinedFunction]
userDefinedFunctions :: Maybe [UserDefinedFunction]
$sel:userDefinedFunctions:GetUserDefinedFunctionsResponse' :: GetUserDefinedFunctionsResponse -> Maybe [UserDefinedFunction]
userDefinedFunctions} -> Maybe [UserDefinedFunction]
userDefinedFunctions) (\s :: GetUserDefinedFunctionsResponse
s@GetUserDefinedFunctionsResponse' {} Maybe [UserDefinedFunction]
a -> GetUserDefinedFunctionsResponse
s {$sel:userDefinedFunctions:GetUserDefinedFunctionsResponse' :: Maybe [UserDefinedFunction]
userDefinedFunctions = Maybe [UserDefinedFunction]
a} :: GetUserDefinedFunctionsResponse) ((Maybe [UserDefinedFunction] -> f (Maybe [UserDefinedFunction]))
 -> GetUserDefinedFunctionsResponse
 -> f GetUserDefinedFunctionsResponse)
-> ((Maybe [UserDefinedFunction]
     -> f (Maybe [UserDefinedFunction]))
    -> Maybe [UserDefinedFunction] -> f (Maybe [UserDefinedFunction]))
-> (Maybe [UserDefinedFunction] -> f (Maybe [UserDefinedFunction]))
-> GetUserDefinedFunctionsResponse
-> f GetUserDefinedFunctionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [UserDefinedFunction]
  [UserDefinedFunction]
  [UserDefinedFunction]
  [UserDefinedFunction]
-> Iso
     (Maybe [UserDefinedFunction])
     (Maybe [UserDefinedFunction])
     (Maybe [UserDefinedFunction])
     (Maybe [UserDefinedFunction])
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
  [UserDefinedFunction]
  [UserDefinedFunction]
  [UserDefinedFunction]
  [UserDefinedFunction]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetUserDefinedFunctionsResponse