{-# 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.ListModels
-- 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 models created with the @CreateModel@ API.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListModels
  ( -- * Creating a Request
    ListModels (..),
    newListModels,

    -- * Request Lenses
    listModels_creationTimeAfter,
    listModels_creationTimeBefore,
    listModels_maxResults,
    listModels_nameContains,
    listModels_nextToken,
    listModels_sortBy,
    listModels_sortOrder,

    -- * Destructuring the Response
    ListModelsResponse (..),
    newListModelsResponse,

    -- * Response Lenses
    listModelsResponse_nextToken,
    listModelsResponse_httpStatus,
    listModelsResponse_models,
  )
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:/ 'newListModels' smart constructor.
data ListModels = ListModels'
  { -- | A filter that returns only models with a creation time greater than or
    -- equal to the specified time (timestamp).
    ListModels -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns only models created before the specified time
    -- (timestamp).
    ListModels -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Data.POSIX,
    -- | The maximum number of models to return in the response.
    ListModels -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A string in the model name. This filter returns only models whose name
    -- contains the specified string.
    ListModels -> Maybe Text
nameContains :: Prelude.Maybe Prelude.Text,
    -- | If the response to a previous @ListModels@ request was truncated, the
    -- response includes a @NextToken@. To retrieve the next set of models, use
    -- the token in the next request.
    ListModels -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Sorts the list of results. The default is @CreationTime@.
    ListModels -> Maybe ModelSortKey
sortBy :: Prelude.Maybe ModelSortKey,
    -- | The sort order for results. The default is @Descending@.
    ListModels -> Maybe OrderKey
sortOrder :: Prelude.Maybe OrderKey
  }
  deriving (ListModels -> ListModels -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListModels -> ListModels -> Bool
$c/= :: ListModels -> ListModels -> Bool
== :: ListModels -> ListModels -> Bool
$c== :: ListModels -> ListModels -> Bool
Prelude.Eq, ReadPrec [ListModels]
ReadPrec ListModels
Int -> ReadS ListModels
ReadS [ListModels]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListModels]
$creadListPrec :: ReadPrec [ListModels]
readPrec :: ReadPrec ListModels
$creadPrec :: ReadPrec ListModels
readList :: ReadS [ListModels]
$creadList :: ReadS [ListModels]
readsPrec :: Int -> ReadS ListModels
$creadsPrec :: Int -> ReadS ListModels
Prelude.Read, Int -> ListModels -> ShowS
[ListModels] -> ShowS
ListModels -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListModels] -> ShowS
$cshowList :: [ListModels] -> ShowS
show :: ListModels -> String
$cshow :: ListModels -> String
showsPrec :: Int -> ListModels -> ShowS
$cshowsPrec :: Int -> ListModels -> ShowS
Prelude.Show, forall x. Rep ListModels x -> ListModels
forall x. ListModels -> Rep ListModels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListModels x -> ListModels
$cfrom :: forall x. ListModels -> Rep ListModels x
Prelude.Generic)

-- |
-- Create a value of 'ListModels' 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', 'listModels_creationTimeAfter' - A filter that returns only models with a creation time greater than or
-- equal to the specified time (timestamp).
--
-- 'creationTimeBefore', 'listModels_creationTimeBefore' - A filter that returns only models created before the specified time
-- (timestamp).
--
-- 'maxResults', 'listModels_maxResults' - The maximum number of models to return in the response.
--
-- 'nameContains', 'listModels_nameContains' - A string in the model name. This filter returns only models whose name
-- contains the specified string.
--
-- 'nextToken', 'listModels_nextToken' - If the response to a previous @ListModels@ request was truncated, the
-- response includes a @NextToken@. To retrieve the next set of models, use
-- the token in the next request.
--
-- 'sortBy', 'listModels_sortBy' - Sorts the list of results. The default is @CreationTime@.
--
-- 'sortOrder', 'listModels_sortOrder' - The sort order for results. The default is @Descending@.
newListModels ::
  ListModels
newListModels :: ListModels
newListModels =
  ListModels'
    { $sel:creationTimeAfter:ListModels' :: Maybe POSIX
creationTimeAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListModels' :: Maybe POSIX
creationTimeBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListModels' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nameContains:ListModels' :: Maybe Text
nameContains = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListModels' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListModels' :: Maybe ModelSortKey
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListModels' :: Maybe OrderKey
sortOrder = forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns only models with a creation time greater than or
-- equal to the specified time (timestamp).
listModels_creationTimeAfter :: Lens.Lens' ListModels (Prelude.Maybe Prelude.UTCTime)
listModels_creationTimeAfter :: Lens' ListModels (Maybe UTCTime)
listModels_creationTimeAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModels' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListModels' :: ListModels -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListModels
s@ListModels' {} Maybe POSIX
a -> ListModels
s {$sel:creationTimeAfter:ListModels' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListModels) 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 models created before the specified time
-- (timestamp).
listModels_creationTimeBefore :: Lens.Lens' ListModels (Prelude.Maybe Prelude.UTCTime)
listModels_creationTimeBefore :: Lens' ListModels (Maybe UTCTime)
listModels_creationTimeBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModels' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListModels' :: ListModels -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListModels
s@ListModels' {} Maybe POSIX
a -> ListModels
s {$sel:creationTimeBefore:ListModels' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListModels) 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 models to return in the response.
listModels_maxResults :: Lens.Lens' ListModels (Prelude.Maybe Prelude.Natural)
listModels_maxResults :: Lens' ListModels (Maybe Natural)
listModels_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModels' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListModels' :: ListModels -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListModels
s@ListModels' {} Maybe Natural
a -> ListModels
s {$sel:maxResults:ListModels' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListModels)

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

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

-- | Sorts the list of results. The default is @CreationTime@.
listModels_sortBy :: Lens.Lens' ListModels (Prelude.Maybe ModelSortKey)
listModels_sortBy :: Lens' ListModels (Maybe ModelSortKey)
listModels_sortBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModels' {Maybe ModelSortKey
sortBy :: Maybe ModelSortKey
$sel:sortBy:ListModels' :: ListModels -> Maybe ModelSortKey
sortBy} -> Maybe ModelSortKey
sortBy) (\s :: ListModels
s@ListModels' {} Maybe ModelSortKey
a -> ListModels
s {$sel:sortBy:ListModels' :: Maybe ModelSortKey
sortBy = Maybe ModelSortKey
a} :: ListModels)

-- | The sort order for results. The default is @Descending@.
listModels_sortOrder :: Lens.Lens' ListModels (Prelude.Maybe OrderKey)
listModels_sortOrder :: Lens' ListModels (Maybe OrderKey)
listModels_sortOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModels' {Maybe OrderKey
sortOrder :: Maybe OrderKey
$sel:sortOrder:ListModels' :: ListModels -> Maybe OrderKey
sortOrder} -> Maybe OrderKey
sortOrder) (\s :: ListModels
s@ListModels' {} Maybe OrderKey
a -> ListModels
s {$sel:sortOrder:ListModels' :: Maybe OrderKey
sortOrder = Maybe OrderKey
a} :: ListModels)

instance Core.AWSPager ListModels where
  page :: ListModels -> AWSResponse ListModels -> Maybe ListModels
page ListModels
rq AWSResponse ListModels
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListModels
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListModelsResponse (Maybe Text)
listModelsResponse_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 ListModels
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListModelsResponse [ModelSummary]
listModelsResponse_models) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListModels
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListModels (Maybe Text)
listModels_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListModels
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListModelsResponse (Maybe Text)
listModelsResponse_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 ListModels where
  type AWSResponse ListModels = ListModelsResponse
  request :: (Service -> Service) -> ListModels -> Request ListModels
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 ListModels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListModels)))
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 -> [ModelSummary] -> ListModelsResponse
ListModelsResponse'
            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
"Models" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListModels where
  hashWithSalt :: Int -> ListModels -> Int
hashWithSalt Int
_salt ListModels' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe ModelSortKey
Maybe OrderKey
sortOrder :: Maybe OrderKey
sortBy :: Maybe ModelSortKey
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:sortOrder:ListModels' :: ListModels -> Maybe OrderKey
$sel:sortBy:ListModels' :: ListModels -> Maybe ModelSortKey
$sel:nextToken:ListModels' :: ListModels -> Maybe Text
$sel:nameContains:ListModels' :: ListModels -> Maybe Text
$sel:maxResults:ListModels' :: ListModels -> Maybe Natural
$sel:creationTimeBefore:ListModels' :: ListModels -> Maybe POSIX
$sel:creationTimeAfter:ListModels' :: ListModels -> 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 ModelSortKey
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OrderKey
sortOrder

instance Prelude.NFData ListModels where
  rnf :: ListModels -> ()
rnf ListModels' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe ModelSortKey
Maybe OrderKey
sortOrder :: Maybe OrderKey
sortBy :: Maybe ModelSortKey
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:sortOrder:ListModels' :: ListModels -> Maybe OrderKey
$sel:sortBy:ListModels' :: ListModels -> Maybe ModelSortKey
$sel:nextToken:ListModels' :: ListModels -> Maybe Text
$sel:nameContains:ListModels' :: ListModels -> Maybe Text
$sel:maxResults:ListModels' :: ListModels -> Maybe Natural
$sel:creationTimeBefore:ListModels' :: ListModels -> Maybe POSIX
$sel:creationTimeAfter:ListModels' :: ListModels -> 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 ModelSortKey
sortBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OrderKey
sortOrder

instance Data.ToHeaders ListModels where
  toHeaders :: ListModels -> 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.ListModels" :: 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 ListModels where
  toJSON :: ListModels -> Value
toJSON ListModels' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe ModelSortKey
Maybe OrderKey
sortOrder :: Maybe OrderKey
sortBy :: Maybe ModelSortKey
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:sortOrder:ListModels' :: ListModels -> Maybe OrderKey
$sel:sortBy:ListModels' :: ListModels -> Maybe ModelSortKey
$sel:nextToken:ListModels' :: ListModels -> Maybe Text
$sel:nameContains:ListModels' :: ListModels -> Maybe Text
$sel:maxResults:ListModels' :: ListModels -> Maybe Natural
$sel:creationTimeBefore:ListModels' :: ListModels -> Maybe POSIX
$sel:creationTimeAfter:ListModels' :: ListModels -> 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 ModelSortKey
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 OrderKey
sortOrder
          ]
      )

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

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

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

-- |
-- Create a value of 'ListModelsResponse' 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', 'listModelsResponse_nextToken' - If the response is truncated, SageMaker returns this token. To retrieve
-- the next set of models, use it in the subsequent request.
--
-- 'httpStatus', 'listModelsResponse_httpStatus' - The response's http status code.
--
-- 'models', 'listModelsResponse_models' - An array of @ModelSummary@ objects, each of which lists a model.
newListModelsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListModelsResponse
newListModelsResponse :: Int -> ListModelsResponse
newListModelsResponse Int
pHttpStatus_ =
  ListModelsResponse'
    { $sel:nextToken:ListModelsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListModelsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:models:ListModelsResponse' :: [ModelSummary]
models = forall a. Monoid a => a
Prelude.mempty
    }

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

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

-- | An array of @ModelSummary@ objects, each of which lists a model.
listModelsResponse_models :: Lens.Lens' ListModelsResponse [ModelSummary]
listModelsResponse_models :: Lens' ListModelsResponse [ModelSummary]
listModelsResponse_models = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelsResponse' {[ModelSummary]
models :: [ModelSummary]
$sel:models:ListModelsResponse' :: ListModelsResponse -> [ModelSummary]
models} -> [ModelSummary]
models) (\s :: ListModelsResponse
s@ListModelsResponse' {} [ModelSummary]
a -> ListModelsResponse
s {$sel:models:ListModelsResponse' :: [ModelSummary]
models = [ModelSummary]
a} :: ListModelsResponse) 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 ListModelsResponse where
  rnf :: ListModelsResponse -> ()
rnf ListModelsResponse' {Int
[ModelSummary]
Maybe Text
models :: [ModelSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:models:ListModelsResponse' :: ListModelsResponse -> [ModelSummary]
$sel:httpStatus:ListModelsResponse' :: ListModelsResponse -> Int
$sel:nextToken:ListModelsResponse' :: ListModelsResponse -> 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 [ModelSummary]
models