{-# 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.ListCompilationJobs
-- 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 model compilation jobs that satisfy various filters.
--
-- To create a model compilation job, use CreateCompilationJob. To get
-- information about a particular model compilation job you have created,
-- use DescribeCompilationJob.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListCompilationJobs
  ( -- * Creating a Request
    ListCompilationJobs (..),
    newListCompilationJobs,

    -- * Request Lenses
    listCompilationJobs_creationTimeAfter,
    listCompilationJobs_creationTimeBefore,
    listCompilationJobs_lastModifiedTimeAfter,
    listCompilationJobs_lastModifiedTimeBefore,
    listCompilationJobs_maxResults,
    listCompilationJobs_nameContains,
    listCompilationJobs_nextToken,
    listCompilationJobs_sortBy,
    listCompilationJobs_sortOrder,
    listCompilationJobs_statusEquals,

    -- * Destructuring the Response
    ListCompilationJobsResponse (..),
    newListCompilationJobsResponse,

    -- * Response Lenses
    listCompilationJobsResponse_nextToken,
    listCompilationJobsResponse_httpStatus,
    listCompilationJobsResponse_compilationJobSummaries,
  )
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:/ 'newListCompilationJobs' smart constructor.
data ListCompilationJobs = ListCompilationJobs'
  { -- | A filter that returns the model compilation jobs that were created after
    -- a specified time.
    ListCompilationJobs -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns the model compilation jobs that were created
    -- before a specified time.
    ListCompilationJobs -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns the model compilation jobs that were modified
    -- after a specified time.
    ListCompilationJobs -> Maybe POSIX
lastModifiedTimeAfter :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns the model compilation jobs that were modified
    -- before a specified time.
    ListCompilationJobs -> Maybe POSIX
lastModifiedTimeBefore :: Prelude.Maybe Data.POSIX,
    -- | The maximum number of model compilation jobs to return in the response.
    ListCompilationJobs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A filter that returns the model compilation jobs whose name contains a
    -- specified string.
    ListCompilationJobs -> Maybe Text
nameContains :: Prelude.Maybe Prelude.Text,
    -- | If the result of the previous @ListCompilationJobs@ request was
    -- truncated, the response includes a @NextToken@. To retrieve the next set
    -- of model compilation jobs, use the token in the next request.
    ListCompilationJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The field by which to sort results. The default is @CreationTime@.
    ListCompilationJobs -> Maybe ListCompilationJobsSortBy
sortBy :: Prelude.Maybe ListCompilationJobsSortBy,
    -- | The sort order for results. The default is @Ascending@.
    ListCompilationJobs -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | A filter that retrieves model compilation jobs with a specific
    -- DescribeCompilationJobResponse$CompilationJobStatus status.
    ListCompilationJobs -> Maybe CompilationJobStatus
statusEquals :: Prelude.Maybe CompilationJobStatus
  }
  deriving (ListCompilationJobs -> ListCompilationJobs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCompilationJobs -> ListCompilationJobs -> Bool
$c/= :: ListCompilationJobs -> ListCompilationJobs -> Bool
== :: ListCompilationJobs -> ListCompilationJobs -> Bool
$c== :: ListCompilationJobs -> ListCompilationJobs -> Bool
Prelude.Eq, ReadPrec [ListCompilationJobs]
ReadPrec ListCompilationJobs
Int -> ReadS ListCompilationJobs
ReadS [ListCompilationJobs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCompilationJobs]
$creadListPrec :: ReadPrec [ListCompilationJobs]
readPrec :: ReadPrec ListCompilationJobs
$creadPrec :: ReadPrec ListCompilationJobs
readList :: ReadS [ListCompilationJobs]
$creadList :: ReadS [ListCompilationJobs]
readsPrec :: Int -> ReadS ListCompilationJobs
$creadsPrec :: Int -> ReadS ListCompilationJobs
Prelude.Read, Int -> ListCompilationJobs -> ShowS
[ListCompilationJobs] -> ShowS
ListCompilationJobs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCompilationJobs] -> ShowS
$cshowList :: [ListCompilationJobs] -> ShowS
show :: ListCompilationJobs -> String
$cshow :: ListCompilationJobs -> String
showsPrec :: Int -> ListCompilationJobs -> ShowS
$cshowsPrec :: Int -> ListCompilationJobs -> ShowS
Prelude.Show, forall x. Rep ListCompilationJobs x -> ListCompilationJobs
forall x. ListCompilationJobs -> Rep ListCompilationJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCompilationJobs x -> ListCompilationJobs
$cfrom :: forall x. ListCompilationJobs -> Rep ListCompilationJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListCompilationJobs' 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', 'listCompilationJobs_creationTimeAfter' - A filter that returns the model compilation jobs that were created after
-- a specified time.
--
-- 'creationTimeBefore', 'listCompilationJobs_creationTimeBefore' - A filter that returns the model compilation jobs that were created
-- before a specified time.
--
-- 'lastModifiedTimeAfter', 'listCompilationJobs_lastModifiedTimeAfter' - A filter that returns the model compilation jobs that were modified
-- after a specified time.
--
-- 'lastModifiedTimeBefore', 'listCompilationJobs_lastModifiedTimeBefore' - A filter that returns the model compilation jobs that were modified
-- before a specified time.
--
-- 'maxResults', 'listCompilationJobs_maxResults' - The maximum number of model compilation jobs to return in the response.
--
-- 'nameContains', 'listCompilationJobs_nameContains' - A filter that returns the model compilation jobs whose name contains a
-- specified string.
--
-- 'nextToken', 'listCompilationJobs_nextToken' - If the result of the previous @ListCompilationJobs@ request was
-- truncated, the response includes a @NextToken@. To retrieve the next set
-- of model compilation jobs, use the token in the next request.
--
-- 'sortBy', 'listCompilationJobs_sortBy' - The field by which to sort results. The default is @CreationTime@.
--
-- 'sortOrder', 'listCompilationJobs_sortOrder' - The sort order for results. The default is @Ascending@.
--
-- 'statusEquals', 'listCompilationJobs_statusEquals' - A filter that retrieves model compilation jobs with a specific
-- DescribeCompilationJobResponse$CompilationJobStatus status.
newListCompilationJobs ::
  ListCompilationJobs
newListCompilationJobs :: ListCompilationJobs
newListCompilationJobs =
  ListCompilationJobs'
    { $sel:creationTimeAfter:ListCompilationJobs' :: Maybe POSIX
creationTimeAfter =
        forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListCompilationJobs' :: Maybe POSIX
creationTimeBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTimeAfter:ListCompilationJobs' :: Maybe POSIX
lastModifiedTimeAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTimeBefore:ListCompilationJobs' :: Maybe POSIX
lastModifiedTimeBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListCompilationJobs' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nameContains:ListCompilationJobs' :: Maybe Text
nameContains = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCompilationJobs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListCompilationJobs' :: Maybe ListCompilationJobsSortBy
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListCompilationJobs' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:statusEquals:ListCompilationJobs' :: Maybe CompilationJobStatus
statusEquals = forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns the model compilation jobs that were created after
-- a specified time.
listCompilationJobs_creationTimeAfter :: Lens.Lens' ListCompilationJobs (Prelude.Maybe Prelude.UTCTime)
listCompilationJobs_creationTimeAfter :: Lens' ListCompilationJobs (Maybe UTCTime)
listCompilationJobs_creationTimeAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe POSIX
a -> ListCompilationJobs
s {$sel:creationTimeAfter:ListCompilationJobs' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListCompilationJobs) 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 the model compilation jobs that were created
-- before a specified time.
listCompilationJobs_creationTimeBefore :: Lens.Lens' ListCompilationJobs (Prelude.Maybe Prelude.UTCTime)
listCompilationJobs_creationTimeBefore :: Lens' ListCompilationJobs (Maybe UTCTime)
listCompilationJobs_creationTimeBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe POSIX
a -> ListCompilationJobs
s {$sel:creationTimeBefore:ListCompilationJobs' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListCompilationJobs) 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 the model compilation jobs that were modified
-- after a specified time.
listCompilationJobs_lastModifiedTimeAfter :: Lens.Lens' ListCompilationJobs (Prelude.Maybe Prelude.UTCTime)
listCompilationJobs_lastModifiedTimeAfter :: Lens' ListCompilationJobs (Maybe UTCTime)
listCompilationJobs_lastModifiedTimeAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe POSIX
lastModifiedTimeAfter :: Maybe POSIX
$sel:lastModifiedTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
lastModifiedTimeAfter} -> Maybe POSIX
lastModifiedTimeAfter) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe POSIX
a -> ListCompilationJobs
s {$sel:lastModifiedTimeAfter:ListCompilationJobs' :: Maybe POSIX
lastModifiedTimeAfter = Maybe POSIX
a} :: ListCompilationJobs) 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 the model compilation jobs that were modified
-- before a specified time.
listCompilationJobs_lastModifiedTimeBefore :: Lens.Lens' ListCompilationJobs (Prelude.Maybe Prelude.UTCTime)
listCompilationJobs_lastModifiedTimeBefore :: Lens' ListCompilationJobs (Maybe UTCTime)
listCompilationJobs_lastModifiedTimeBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe POSIX
lastModifiedTimeBefore :: Maybe POSIX
$sel:lastModifiedTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
lastModifiedTimeBefore} -> Maybe POSIX
lastModifiedTimeBefore) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe POSIX
a -> ListCompilationJobs
s {$sel:lastModifiedTimeBefore:ListCompilationJobs' :: Maybe POSIX
lastModifiedTimeBefore = Maybe POSIX
a} :: ListCompilationJobs) 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 model compilation jobs to return in the response.
listCompilationJobs_maxResults :: Lens.Lens' ListCompilationJobs (Prelude.Maybe Prelude.Natural)
listCompilationJobs_maxResults :: Lens' ListCompilationJobs (Maybe Natural)
listCompilationJobs_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCompilationJobs' :: ListCompilationJobs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe Natural
a -> ListCompilationJobs
s {$sel:maxResults:ListCompilationJobs' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCompilationJobs)

-- | A filter that returns the model compilation jobs whose name contains a
-- specified string.
listCompilationJobs_nameContains :: Lens.Lens' ListCompilationJobs (Prelude.Maybe Prelude.Text)
listCompilationJobs_nameContains :: Lens' ListCompilationJobs (Maybe Text)
listCompilationJobs_nameContains = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe Text
nameContains :: Maybe Text
$sel:nameContains:ListCompilationJobs' :: ListCompilationJobs -> Maybe Text
nameContains} -> Maybe Text
nameContains) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe Text
a -> ListCompilationJobs
s {$sel:nameContains:ListCompilationJobs' :: Maybe Text
nameContains = Maybe Text
a} :: ListCompilationJobs)

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

-- | The field by which to sort results. The default is @CreationTime@.
listCompilationJobs_sortBy :: Lens.Lens' ListCompilationJobs (Prelude.Maybe ListCompilationJobsSortBy)
listCompilationJobs_sortBy :: Lens' ListCompilationJobs (Maybe ListCompilationJobsSortBy)
listCompilationJobs_sortBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe ListCompilationJobsSortBy
sortBy :: Maybe ListCompilationJobsSortBy
$sel:sortBy:ListCompilationJobs' :: ListCompilationJobs -> Maybe ListCompilationJobsSortBy
sortBy} -> Maybe ListCompilationJobsSortBy
sortBy) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe ListCompilationJobsSortBy
a -> ListCompilationJobs
s {$sel:sortBy:ListCompilationJobs' :: Maybe ListCompilationJobsSortBy
sortBy = Maybe ListCompilationJobsSortBy
a} :: ListCompilationJobs)

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

-- | A filter that retrieves model compilation jobs with a specific
-- DescribeCompilationJobResponse$CompilationJobStatus status.
listCompilationJobs_statusEquals :: Lens.Lens' ListCompilationJobs (Prelude.Maybe CompilationJobStatus)
listCompilationJobs_statusEquals :: Lens' ListCompilationJobs (Maybe CompilationJobStatus)
listCompilationJobs_statusEquals = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobs' {Maybe CompilationJobStatus
statusEquals :: Maybe CompilationJobStatus
$sel:statusEquals:ListCompilationJobs' :: ListCompilationJobs -> Maybe CompilationJobStatus
statusEquals} -> Maybe CompilationJobStatus
statusEquals) (\s :: ListCompilationJobs
s@ListCompilationJobs' {} Maybe CompilationJobStatus
a -> ListCompilationJobs
s {$sel:statusEquals:ListCompilationJobs' :: Maybe CompilationJobStatus
statusEquals = Maybe CompilationJobStatus
a} :: ListCompilationJobs)

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

instance Prelude.Hashable ListCompilationJobs where
  hashWithSalt :: Int -> ListCompilationJobs -> Int
hashWithSalt Int
_salt ListCompilationJobs' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe CompilationJobStatus
Maybe ListCompilationJobsSortBy
Maybe SortOrder
statusEquals :: Maybe CompilationJobStatus
sortOrder :: Maybe SortOrder
sortBy :: Maybe ListCompilationJobsSortBy
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
lastModifiedTimeBefore :: Maybe POSIX
lastModifiedTimeAfter :: Maybe POSIX
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:statusEquals:ListCompilationJobs' :: ListCompilationJobs -> Maybe CompilationJobStatus
$sel:sortOrder:ListCompilationJobs' :: ListCompilationJobs -> Maybe SortOrder
$sel:sortBy:ListCompilationJobs' :: ListCompilationJobs -> Maybe ListCompilationJobsSortBy
$sel:nextToken:ListCompilationJobs' :: ListCompilationJobs -> Maybe Text
$sel:nameContains:ListCompilationJobs' :: ListCompilationJobs -> Maybe Text
$sel:maxResults:ListCompilationJobs' :: ListCompilationJobs -> Maybe Natural
$sel:lastModifiedTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:lastModifiedTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:creationTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:creationTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> 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 POSIX
lastModifiedTimeAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTimeBefore
      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 ListCompilationJobsSortBy
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CompilationJobStatus
statusEquals

instance Prelude.NFData ListCompilationJobs where
  rnf :: ListCompilationJobs -> ()
rnf ListCompilationJobs' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe CompilationJobStatus
Maybe ListCompilationJobsSortBy
Maybe SortOrder
statusEquals :: Maybe CompilationJobStatus
sortOrder :: Maybe SortOrder
sortBy :: Maybe ListCompilationJobsSortBy
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
lastModifiedTimeBefore :: Maybe POSIX
lastModifiedTimeAfter :: Maybe POSIX
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:statusEquals:ListCompilationJobs' :: ListCompilationJobs -> Maybe CompilationJobStatus
$sel:sortOrder:ListCompilationJobs' :: ListCompilationJobs -> Maybe SortOrder
$sel:sortBy:ListCompilationJobs' :: ListCompilationJobs -> Maybe ListCompilationJobsSortBy
$sel:nextToken:ListCompilationJobs' :: ListCompilationJobs -> Maybe Text
$sel:nameContains:ListCompilationJobs' :: ListCompilationJobs -> Maybe Text
$sel:maxResults:ListCompilationJobs' :: ListCompilationJobs -> Maybe Natural
$sel:lastModifiedTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:lastModifiedTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:creationTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:creationTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> 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 POSIX
lastModifiedTimeAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTimeBefore
      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 ListCompilationJobsSortBy
sortBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sortOrder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CompilationJobStatus
statusEquals

instance Data.ToHeaders ListCompilationJobs where
  toHeaders :: ListCompilationJobs -> 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.ListCompilationJobs" ::
                          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 ListCompilationJobs where
  toJSON :: ListCompilationJobs -> Value
toJSON ListCompilationJobs' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe CompilationJobStatus
Maybe ListCompilationJobsSortBy
Maybe SortOrder
statusEquals :: Maybe CompilationJobStatus
sortOrder :: Maybe SortOrder
sortBy :: Maybe ListCompilationJobsSortBy
nextToken :: Maybe Text
nameContains :: Maybe Text
maxResults :: Maybe Natural
lastModifiedTimeBefore :: Maybe POSIX
lastModifiedTimeAfter :: Maybe POSIX
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:statusEquals:ListCompilationJobs' :: ListCompilationJobs -> Maybe CompilationJobStatus
$sel:sortOrder:ListCompilationJobs' :: ListCompilationJobs -> Maybe SortOrder
$sel:sortBy:ListCompilationJobs' :: ListCompilationJobs -> Maybe ListCompilationJobsSortBy
$sel:nextToken:ListCompilationJobs' :: ListCompilationJobs -> Maybe Text
$sel:nameContains:ListCompilationJobs' :: ListCompilationJobs -> Maybe Text
$sel:maxResults:ListCompilationJobs' :: ListCompilationJobs -> Maybe Natural
$sel:lastModifiedTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:lastModifiedTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:creationTimeBefore:ListCompilationJobs' :: ListCompilationJobs -> Maybe POSIX
$sel:creationTimeAfter:ListCompilationJobs' :: ListCompilationJobs -> 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
"LastModifiedTimeAfter" 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
lastModifiedTimeAfter,
            (Key
"LastModifiedTimeBefore" 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
lastModifiedTimeBefore,
            (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 ListCompilationJobsSortBy
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,
            (Key
"StatusEquals" 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 CompilationJobStatus
statusEquals
          ]
      )

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

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

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

-- |
-- Create a value of 'ListCompilationJobsResponse' 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', 'listCompilationJobsResponse_nextToken' - If the response is truncated, Amazon SageMaker returns this @NextToken@.
-- To retrieve the next set of model compilation jobs, use this token in
-- the next request.
--
-- 'httpStatus', 'listCompilationJobsResponse_httpStatus' - The response's http status code.
--
-- 'compilationJobSummaries', 'listCompilationJobsResponse_compilationJobSummaries' - An array of CompilationJobSummary objects, each describing a model
-- compilation job.
newListCompilationJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListCompilationJobsResponse
newListCompilationJobsResponse :: Int -> ListCompilationJobsResponse
newListCompilationJobsResponse Int
pHttpStatus_ =
  ListCompilationJobsResponse'
    { $sel:nextToken:ListCompilationJobsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListCompilationJobsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:compilationJobSummaries:ListCompilationJobsResponse' :: [CompilationJobSummary]
compilationJobSummaries = forall a. Monoid a => a
Prelude.mempty
    }

-- | If the response is truncated, Amazon SageMaker returns this @NextToken@.
-- To retrieve the next set of model compilation jobs, use this token in
-- the next request.
listCompilationJobsResponse_nextToken :: Lens.Lens' ListCompilationJobsResponse (Prelude.Maybe Prelude.Text)
listCompilationJobsResponse_nextToken :: Lens' ListCompilationJobsResponse (Maybe Text)
listCompilationJobsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCompilationJobsResponse' :: ListCompilationJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCompilationJobsResponse
s@ListCompilationJobsResponse' {} Maybe Text
a -> ListCompilationJobsResponse
s {$sel:nextToken:ListCompilationJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCompilationJobsResponse)

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

-- | An array of CompilationJobSummary objects, each describing a model
-- compilation job.
listCompilationJobsResponse_compilationJobSummaries :: Lens.Lens' ListCompilationJobsResponse [CompilationJobSummary]
listCompilationJobsResponse_compilationJobSummaries :: Lens' ListCompilationJobsResponse [CompilationJobSummary]
listCompilationJobsResponse_compilationJobSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCompilationJobsResponse' {[CompilationJobSummary]
compilationJobSummaries :: [CompilationJobSummary]
$sel:compilationJobSummaries:ListCompilationJobsResponse' :: ListCompilationJobsResponse -> [CompilationJobSummary]
compilationJobSummaries} -> [CompilationJobSummary]
compilationJobSummaries) (\s :: ListCompilationJobsResponse
s@ListCompilationJobsResponse' {} [CompilationJobSummary]
a -> ListCompilationJobsResponse
s {$sel:compilationJobSummaries:ListCompilationJobsResponse' :: [CompilationJobSummary]
compilationJobSummaries = [CompilationJobSummary]
a} :: ListCompilationJobsResponse) 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 ListCompilationJobsResponse where
  rnf :: ListCompilationJobsResponse -> ()
rnf ListCompilationJobsResponse' {Int
[CompilationJobSummary]
Maybe Text
compilationJobSummaries :: [CompilationJobSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:compilationJobSummaries:ListCompilationJobsResponse' :: ListCompilationJobsResponse -> [CompilationJobSummary]
$sel:httpStatus:ListCompilationJobsResponse' :: ListCompilationJobsResponse -> Int
$sel:nextToken:ListCompilationJobsResponse' :: ListCompilationJobsResponse -> 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 [CompilationJobSummary]
compilationJobSummaries