{-# 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.SageMaker.ListAlgorithms
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the machine learning algorithms that have been created.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListAlgorithms
  ( -- * Creating a Request
    ListAlgorithms (..),
    newListAlgorithms,

    -- * Request Lenses
    listAlgorithms_creationTimeAfter,
    listAlgorithms_creationTimeBefore,
    listAlgorithms_maxResults,
    listAlgorithms_nameContains,
    listAlgorithms_nextToken,
    listAlgorithms_sortBy,
    listAlgorithms_sortOrder,

    -- * Destructuring the Response
    ListAlgorithmsResponse (..),
    newListAlgorithmsResponse,

    -- * Response Lenses
    listAlgorithmsResponse_nextToken,
    listAlgorithmsResponse_httpStatus,
    listAlgorithmsResponse_algorithmSummaryList,
  )
where

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

-- | /See:/ 'newListAlgorithms' smart constructor.
data ListAlgorithms = ListAlgorithms'
  { -- | A filter that returns only algorithms created after the specified time
    -- (timestamp).
    ListAlgorithms -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns only algorithms created before the specified time
    -- (timestamp).
    ListAlgorithms -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Data.POSIX,
    -- | The maximum number of algorithms to return in the response.
    ListAlgorithms -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A string in the algorithm name. This filter returns only algorithms
    -- whose name contains the specified string.
    ListAlgorithms -> Maybe Text
nameContains :: Prelude.Maybe Prelude.Text,
    -- | If the response to a previous @ListAlgorithms@ request was truncated,
    -- the response includes a @NextToken@. To retrieve the next set of
    -- algorithms, use the token in the next request.
    ListAlgorithms -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The parameter by which to sort the results. The default is
    -- @CreationTime@.
    ListAlgorithms -> Maybe AlgorithmSortBy
sortBy :: Prelude.Maybe AlgorithmSortBy,
    -- | The sort order for the results. The default is @Ascending@.
    ListAlgorithms -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder
  }
  deriving (ListAlgorithms -> ListAlgorithms -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAlgorithms -> ListAlgorithms -> Bool
$c/= :: ListAlgorithms -> ListAlgorithms -> Bool
== :: ListAlgorithms -> ListAlgorithms -> Bool
$c== :: ListAlgorithms -> ListAlgorithms -> Bool
Prelude.Eq, ReadPrec [ListAlgorithms]
ReadPrec ListAlgorithms
Int -> ReadS ListAlgorithms
ReadS [ListAlgorithms]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAlgorithms]
$creadListPrec :: ReadPrec [ListAlgorithms]
readPrec :: ReadPrec ListAlgorithms
$creadPrec :: ReadPrec ListAlgorithms
readList :: ReadS [ListAlgorithms]
$creadList :: ReadS [ListAlgorithms]
readsPrec :: Int -> ReadS ListAlgorithms
$creadsPrec :: Int -> ReadS ListAlgorithms
Prelude.Read, Int -> ListAlgorithms -> ShowS
[ListAlgorithms] -> ShowS
ListAlgorithms -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAlgorithms] -> ShowS
$cshowList :: [ListAlgorithms] -> ShowS
show :: ListAlgorithms -> String
$cshow :: ListAlgorithms -> String
showsPrec :: Int -> ListAlgorithms -> ShowS
$cshowsPrec :: Int -> ListAlgorithms -> ShowS
Prelude.Show, forall x. Rep ListAlgorithms x -> ListAlgorithms
forall x. ListAlgorithms -> Rep ListAlgorithms x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAlgorithms x -> ListAlgorithms
$cfrom :: forall x. ListAlgorithms -> Rep ListAlgorithms x
Prelude.Generic)

-- |
-- Create a value of 'ListAlgorithms' 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:
--
-- 'creationTimeAfter', 'listAlgorithms_creationTimeAfter' - A filter that returns only algorithms created after the specified time
-- (timestamp).
--
-- 'creationTimeBefore', 'listAlgorithms_creationTimeBefore' - A filter that returns only algorithms created before the specified time
-- (timestamp).
--
-- 'maxResults', 'listAlgorithms_maxResults' - The maximum number of algorithms to return in the response.
--
-- 'nameContains', 'listAlgorithms_nameContains' - A string in the algorithm name. This filter returns only algorithms
-- whose name contains the specified string.
--
-- 'nextToken', 'listAlgorithms_nextToken' - If the response to a previous @ListAlgorithms@ request was truncated,
-- the response includes a @NextToken@. To retrieve the next set of
-- algorithms, use the token in the next request.
--
-- 'sortBy', 'listAlgorithms_sortBy' - The parameter by which to sort the results. The default is
-- @CreationTime@.
--
-- 'sortOrder', 'listAlgorithms_sortOrder' - The sort order for the results. The default is @Ascending@.
newListAlgorithms ::
  ListAlgorithms
newListAlgorithms :: ListAlgorithms
newListAlgorithms =
  ListAlgorithms'
    { $sel:creationTimeAfter:ListAlgorithms' :: Maybe POSIX
creationTimeAfter =
        forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListAlgorithms' :: Maybe POSIX
creationTimeBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAlgorithms' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nameContains:ListAlgorithms' :: Maybe Text
nameContains = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAlgorithms' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListAlgorithms' :: Maybe AlgorithmSortBy
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListAlgorithms' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns only algorithms created after the specified time
-- (timestamp).
listAlgorithms_creationTimeAfter :: Lens.Lens' ListAlgorithms (Prelude.Maybe Prelude.UTCTime)
listAlgorithms_creationTimeAfter :: Lens' ListAlgorithms (Maybe UTCTime)
listAlgorithms_creationTimeAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithms' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListAlgorithms
s@ListAlgorithms' {} Maybe POSIX
a -> ListAlgorithms
s {$sel:creationTimeAfter:ListAlgorithms' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListAlgorithms) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A filter that returns only algorithms created before the specified time
-- (timestamp).
listAlgorithms_creationTimeBefore :: Lens.Lens' ListAlgorithms (Prelude.Maybe Prelude.UTCTime)
listAlgorithms_creationTimeBefore :: Lens' ListAlgorithms (Maybe UTCTime)
listAlgorithms_creationTimeBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithms' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListAlgorithms
s@ListAlgorithms' {} Maybe POSIX
a -> ListAlgorithms
s {$sel:creationTimeBefore:ListAlgorithms' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListAlgorithms) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The maximum number of algorithms to return in the response.
listAlgorithms_maxResults :: Lens.Lens' ListAlgorithms (Prelude.Maybe Prelude.Natural)
listAlgorithms_maxResults :: Lens' ListAlgorithms (Maybe Natural)
listAlgorithms_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithms' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAlgorithms' :: ListAlgorithms -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAlgorithms
s@ListAlgorithms' {} Maybe Natural
a -> ListAlgorithms
s {$sel:maxResults:ListAlgorithms' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAlgorithms)

-- | A string in the algorithm name. This filter returns only algorithms
-- whose name contains the specified string.
listAlgorithms_nameContains :: Lens.Lens' ListAlgorithms (Prelude.Maybe Prelude.Text)
listAlgorithms_nameContains :: Lens' ListAlgorithms (Maybe Text)
listAlgorithms_nameContains = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithms' {Maybe Text
nameContains :: Maybe Text
$sel:nameContains:ListAlgorithms' :: ListAlgorithms -> Maybe Text
nameContains} -> Maybe Text
nameContains) (\s :: ListAlgorithms
s@ListAlgorithms' {} Maybe Text
a -> ListAlgorithms
s {$sel:nameContains:ListAlgorithms' :: Maybe Text
nameContains = Maybe Text
a} :: ListAlgorithms)

-- | If the response to a previous @ListAlgorithms@ request was truncated,
-- the response includes a @NextToken@. To retrieve the next set of
-- algorithms, use the token in the next request.
listAlgorithms_nextToken :: Lens.Lens' ListAlgorithms (Prelude.Maybe Prelude.Text)
listAlgorithms_nextToken :: Lens' ListAlgorithms (Maybe Text)
listAlgorithms_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithms' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAlgorithms' :: ListAlgorithms -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAlgorithms
s@ListAlgorithms' {} Maybe Text
a -> ListAlgorithms
s {$sel:nextToken:ListAlgorithms' :: Maybe Text
nextToken = Maybe Text
a} :: ListAlgorithms)

-- | The parameter by which to sort the results. The default is
-- @CreationTime@.
listAlgorithms_sortBy :: Lens.Lens' ListAlgorithms (Prelude.Maybe AlgorithmSortBy)
listAlgorithms_sortBy :: Lens' ListAlgorithms (Maybe AlgorithmSortBy)
listAlgorithms_sortBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithms' {Maybe AlgorithmSortBy
sortBy :: Maybe AlgorithmSortBy
$sel:sortBy:ListAlgorithms' :: ListAlgorithms -> Maybe AlgorithmSortBy
sortBy} -> Maybe AlgorithmSortBy
sortBy) (\s :: ListAlgorithms
s@ListAlgorithms' {} Maybe AlgorithmSortBy
a -> ListAlgorithms
s {$sel:sortBy:ListAlgorithms' :: Maybe AlgorithmSortBy
sortBy = Maybe AlgorithmSortBy
a} :: ListAlgorithms)

-- | The sort order for the results. The default is @Ascending@.
listAlgorithms_sortOrder :: Lens.Lens' ListAlgorithms (Prelude.Maybe SortOrder)
listAlgorithms_sortOrder :: Lens' ListAlgorithms (Maybe SortOrder)
listAlgorithms_sortOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithms' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListAlgorithms' :: ListAlgorithms -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListAlgorithms
s@ListAlgorithms' {} Maybe SortOrder
a -> ListAlgorithms
s {$sel:sortOrder:ListAlgorithms' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListAlgorithms)

instance Core.AWSPager ListAlgorithms where
  page :: ListAlgorithms
-> AWSResponse ListAlgorithms -> Maybe ListAlgorithms
page ListAlgorithms
rq AWSResponse ListAlgorithms
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAlgorithms
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAlgorithmsResponse (Maybe Text)
listAlgorithmsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAlgorithms
rs
            forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListAlgorithmsResponse [AlgorithmSummary]
listAlgorithmsResponse_algorithmSummaryList
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListAlgorithms
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAlgorithms (Maybe Text)
listAlgorithms_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAlgorithms
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAlgorithmsResponse (Maybe Text)
listAlgorithmsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListAlgorithms where
  type
    AWSResponse ListAlgorithms =
      ListAlgorithmsResponse
  request :: (Service -> Service) -> ListAlgorithms -> Request ListAlgorithms
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListAlgorithms
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAlgorithms)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> [AlgorithmSummary] -> ListAlgorithmsResponse
ListAlgorithmsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AlgorithmSummaryList"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListAlgorithms where
  hashWithSalt :: Int -> ListAlgorithms -> Int
hashWithSalt Int
_salt ListAlgorithms' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe AlgorithmSortBy
Maybe SortOrder
sortOrder :: Maybe SortOrder
sortBy :: Maybe AlgorithmSortBy
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:sortOrder:ListAlgorithms' :: ListAlgorithms -> Maybe SortOrder
$sel:sortBy:ListAlgorithms' :: ListAlgorithms -> Maybe AlgorithmSortBy
$sel:nextToken:ListAlgorithms' :: ListAlgorithms -> Maybe Text
$sel:nameContains:ListAlgorithms' :: ListAlgorithms -> Maybe Text
$sel:maxResults:ListAlgorithms' :: ListAlgorithms -> Maybe Natural
$sel:creationTimeBefore:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
$sel:creationTimeAfter:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimeAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimeBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nameContains
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AlgorithmSortBy
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder

instance Prelude.NFData ListAlgorithms where
  rnf :: ListAlgorithms -> ()
rnf ListAlgorithms' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe AlgorithmSortBy
Maybe SortOrder
sortOrder :: Maybe SortOrder
sortBy :: Maybe AlgorithmSortBy
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:sortOrder:ListAlgorithms' :: ListAlgorithms -> Maybe SortOrder
$sel:sortBy:ListAlgorithms' :: ListAlgorithms -> Maybe AlgorithmSortBy
$sel:nextToken:ListAlgorithms' :: ListAlgorithms -> Maybe Text
$sel:nameContains:ListAlgorithms' :: ListAlgorithms -> Maybe Text
$sel:maxResults:ListAlgorithms' :: ListAlgorithms -> Maybe Natural
$sel:creationTimeBefore:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
$sel:creationTimeAfter:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimeAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimeBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nameContains
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AlgorithmSortBy
sortBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sortOrder

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

instance Data.ToJSON ListAlgorithms where
  toJSON :: ListAlgorithms -> Value
toJSON ListAlgorithms' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe AlgorithmSortBy
Maybe SortOrder
sortOrder :: Maybe SortOrder
sortBy :: Maybe AlgorithmSortBy
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:sortOrder:ListAlgorithms' :: ListAlgorithms -> Maybe SortOrder
$sel:sortBy:ListAlgorithms' :: ListAlgorithms -> Maybe AlgorithmSortBy
$sel:nextToken:ListAlgorithms' :: ListAlgorithms -> Maybe Text
$sel:nameContains:ListAlgorithms' :: ListAlgorithms -> Maybe Text
$sel:maxResults:ListAlgorithms' :: ListAlgorithms -> Maybe Natural
$sel:creationTimeBefore:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
$sel:creationTimeAfter:ListAlgorithms' :: ListAlgorithms -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CreationTimeAfter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
creationTimeAfter,
            (Key
"CreationTimeBefore" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
creationTimeBefore,
            (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NameContains" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nameContains,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"SortBy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AlgorithmSortBy
sortBy,
            (Key
"SortOrder" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrder
sortOrder
          ]
      )

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

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

-- | /See:/ 'newListAlgorithmsResponse' smart constructor.
data ListAlgorithmsResponse = ListAlgorithmsResponse'
  { -- | If the response is truncated, SageMaker returns this token. To retrieve
    -- the next set of algorithms, use it in the subsequent request.
    ListAlgorithmsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAlgorithmsResponse -> Int
httpStatus :: Prelude.Int,
    -- | >An array of @AlgorithmSummary@ objects, each of which lists an
    -- algorithm.
    ListAlgorithmsResponse -> [AlgorithmSummary]
algorithmSummaryList :: [AlgorithmSummary]
  }
  deriving (ListAlgorithmsResponse -> ListAlgorithmsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAlgorithmsResponse -> ListAlgorithmsResponse -> Bool
$c/= :: ListAlgorithmsResponse -> ListAlgorithmsResponse -> Bool
== :: ListAlgorithmsResponse -> ListAlgorithmsResponse -> Bool
$c== :: ListAlgorithmsResponse -> ListAlgorithmsResponse -> Bool
Prelude.Eq, ReadPrec [ListAlgorithmsResponse]
ReadPrec ListAlgorithmsResponse
Int -> ReadS ListAlgorithmsResponse
ReadS [ListAlgorithmsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAlgorithmsResponse]
$creadListPrec :: ReadPrec [ListAlgorithmsResponse]
readPrec :: ReadPrec ListAlgorithmsResponse
$creadPrec :: ReadPrec ListAlgorithmsResponse
readList :: ReadS [ListAlgorithmsResponse]
$creadList :: ReadS [ListAlgorithmsResponse]
readsPrec :: Int -> ReadS ListAlgorithmsResponse
$creadsPrec :: Int -> ReadS ListAlgorithmsResponse
Prelude.Read, Int -> ListAlgorithmsResponse -> ShowS
[ListAlgorithmsResponse] -> ShowS
ListAlgorithmsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAlgorithmsResponse] -> ShowS
$cshowList :: [ListAlgorithmsResponse] -> ShowS
show :: ListAlgorithmsResponse -> String
$cshow :: ListAlgorithmsResponse -> String
showsPrec :: Int -> ListAlgorithmsResponse -> ShowS
$cshowsPrec :: Int -> ListAlgorithmsResponse -> ShowS
Prelude.Show, forall x. Rep ListAlgorithmsResponse x -> ListAlgorithmsResponse
forall x. ListAlgorithmsResponse -> Rep ListAlgorithmsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAlgorithmsResponse x -> ListAlgorithmsResponse
$cfrom :: forall x. ListAlgorithmsResponse -> Rep ListAlgorithmsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAlgorithmsResponse' 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', 'listAlgorithmsResponse_nextToken' - If the response is truncated, SageMaker returns this token. To retrieve
-- the next set of algorithms, use it in the subsequent request.
--
-- 'httpStatus', 'listAlgorithmsResponse_httpStatus' - The response's http status code.
--
-- 'algorithmSummaryList', 'listAlgorithmsResponse_algorithmSummaryList' - >An array of @AlgorithmSummary@ objects, each of which lists an
-- algorithm.
newListAlgorithmsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAlgorithmsResponse
newListAlgorithmsResponse :: Int -> ListAlgorithmsResponse
newListAlgorithmsResponse Int
pHttpStatus_ =
  ListAlgorithmsResponse'
    { $sel:nextToken:ListAlgorithmsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAlgorithmsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:algorithmSummaryList:ListAlgorithmsResponse' :: [AlgorithmSummary]
algorithmSummaryList = forall a. Monoid a => a
Prelude.mempty
    }

-- | If the response is truncated, SageMaker returns this token. To retrieve
-- the next set of algorithms, use it in the subsequent request.
listAlgorithmsResponse_nextToken :: Lens.Lens' ListAlgorithmsResponse (Prelude.Maybe Prelude.Text)
listAlgorithmsResponse_nextToken :: Lens' ListAlgorithmsResponse (Maybe Text)
listAlgorithmsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithmsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAlgorithmsResponse' :: ListAlgorithmsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAlgorithmsResponse
s@ListAlgorithmsResponse' {} Maybe Text
a -> ListAlgorithmsResponse
s {$sel:nextToken:ListAlgorithmsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAlgorithmsResponse)

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

-- | >An array of @AlgorithmSummary@ objects, each of which lists an
-- algorithm.
listAlgorithmsResponse_algorithmSummaryList :: Lens.Lens' ListAlgorithmsResponse [AlgorithmSummary]
listAlgorithmsResponse_algorithmSummaryList :: Lens' ListAlgorithmsResponse [AlgorithmSummary]
listAlgorithmsResponse_algorithmSummaryList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAlgorithmsResponse' {[AlgorithmSummary]
algorithmSummaryList :: [AlgorithmSummary]
$sel:algorithmSummaryList:ListAlgorithmsResponse' :: ListAlgorithmsResponse -> [AlgorithmSummary]
algorithmSummaryList} -> [AlgorithmSummary]
algorithmSummaryList) (\s :: ListAlgorithmsResponse
s@ListAlgorithmsResponse' {} [AlgorithmSummary]
a -> ListAlgorithmsResponse
s {$sel:algorithmSummaryList:ListAlgorithmsResponse' :: [AlgorithmSummary]
algorithmSummaryList = [AlgorithmSummary]
a} :: ListAlgorithmsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListAlgorithmsResponse where
  rnf :: ListAlgorithmsResponse -> ()
rnf ListAlgorithmsResponse' {Int
[AlgorithmSummary]
Maybe Text
algorithmSummaryList :: [AlgorithmSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:algorithmSummaryList:ListAlgorithmsResponse' :: ListAlgorithmsResponse -> [AlgorithmSummary]
$sel:httpStatus:ListAlgorithmsResponse' :: ListAlgorithmsResponse -> Int
$sel:nextToken:ListAlgorithmsResponse' :: ListAlgorithmsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [AlgorithmSummary]
algorithmSummaryList