{-# 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.ListCandidatesForAutoMLJob
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- List the candidates created for the job.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListCandidatesForAutoMLJob
  ( -- * Creating a Request
    ListCandidatesForAutoMLJob (..),
    newListCandidatesForAutoMLJob,

    -- * Request Lenses
    listCandidatesForAutoMLJob_candidateNameEquals,
    listCandidatesForAutoMLJob_nextToken,
    listCandidatesForAutoMLJob_sortOrder,
    listCandidatesForAutoMLJob_statusEquals,
    listCandidatesForAutoMLJob_maxResults,
    listCandidatesForAutoMLJob_sortBy,
    listCandidatesForAutoMLJob_autoMLJobName,

    -- * Destructuring the Response
    ListCandidatesForAutoMLJobResponse (..),
    newListCandidatesForAutoMLJobResponse,

    -- * Response Lenses
    listCandidatesForAutoMLJobResponse_nextToken,
    listCandidatesForAutoMLJobResponse_httpStatus,
    listCandidatesForAutoMLJobResponse_candidates,
  )
where

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

-- | /See:/ 'newListCandidatesForAutoMLJob' smart constructor.
data ListCandidatesForAutoMLJob = ListCandidatesForAutoMLJob'
  { -- | List the candidates for the job and filter by candidate name.
    ListCandidatesForAutoMLJob -> Maybe Text
candidateNameEquals :: Prelude.Maybe Prelude.Text,
    -- | If the previous response was truncated, you receive this token. Use it
    -- in your next request to receive the next set of results.
    ListCandidatesForAutoMLJob -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order for the results. The default is @Ascending@.
    ListCandidatesForAutoMLJob -> Maybe AutoMLSortOrder
sortOrder :: Prelude.Maybe AutoMLSortOrder,
    -- | List the candidates for the job and filter by status.
    ListCandidatesForAutoMLJob -> Maybe CandidateStatus
statusEquals :: Prelude.Maybe CandidateStatus,
    -- | List the job\'s candidates up to a specified limit.
    ListCandidatesForAutoMLJob -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The parameter by which to sort the results. The default is @Descending@.
    ListCandidatesForAutoMLJob -> Maybe CandidateSortBy
sortBy :: Prelude.Maybe CandidateSortBy,
    -- | List the candidates created for the job by providing the job\'s name.
    ListCandidatesForAutoMLJob -> Text
autoMLJobName :: Prelude.Text
  }
  deriving (ListCandidatesForAutoMLJob -> ListCandidatesForAutoMLJob -> Bool
(ListCandidatesForAutoMLJob -> ListCandidatesForAutoMLJob -> Bool)
-> (ListCandidatesForAutoMLJob
    -> ListCandidatesForAutoMLJob -> Bool)
-> Eq ListCandidatesForAutoMLJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCandidatesForAutoMLJob -> ListCandidatesForAutoMLJob -> Bool
$c/= :: ListCandidatesForAutoMLJob -> ListCandidatesForAutoMLJob -> Bool
== :: ListCandidatesForAutoMLJob -> ListCandidatesForAutoMLJob -> Bool
$c== :: ListCandidatesForAutoMLJob -> ListCandidatesForAutoMLJob -> Bool
Prelude.Eq, ReadPrec [ListCandidatesForAutoMLJob]
ReadPrec ListCandidatesForAutoMLJob
Int -> ReadS ListCandidatesForAutoMLJob
ReadS [ListCandidatesForAutoMLJob]
(Int -> ReadS ListCandidatesForAutoMLJob)
-> ReadS [ListCandidatesForAutoMLJob]
-> ReadPrec ListCandidatesForAutoMLJob
-> ReadPrec [ListCandidatesForAutoMLJob]
-> Read ListCandidatesForAutoMLJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCandidatesForAutoMLJob]
$creadListPrec :: ReadPrec [ListCandidatesForAutoMLJob]
readPrec :: ReadPrec ListCandidatesForAutoMLJob
$creadPrec :: ReadPrec ListCandidatesForAutoMLJob
readList :: ReadS [ListCandidatesForAutoMLJob]
$creadList :: ReadS [ListCandidatesForAutoMLJob]
readsPrec :: Int -> ReadS ListCandidatesForAutoMLJob
$creadsPrec :: Int -> ReadS ListCandidatesForAutoMLJob
Prelude.Read, Int -> ListCandidatesForAutoMLJob -> ShowS
[ListCandidatesForAutoMLJob] -> ShowS
ListCandidatesForAutoMLJob -> String
(Int -> ListCandidatesForAutoMLJob -> ShowS)
-> (ListCandidatesForAutoMLJob -> String)
-> ([ListCandidatesForAutoMLJob] -> ShowS)
-> Show ListCandidatesForAutoMLJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCandidatesForAutoMLJob] -> ShowS
$cshowList :: [ListCandidatesForAutoMLJob] -> ShowS
show :: ListCandidatesForAutoMLJob -> String
$cshow :: ListCandidatesForAutoMLJob -> String
showsPrec :: Int -> ListCandidatesForAutoMLJob -> ShowS
$cshowsPrec :: Int -> ListCandidatesForAutoMLJob -> ShowS
Prelude.Show, (forall x.
 ListCandidatesForAutoMLJob -> Rep ListCandidatesForAutoMLJob x)
-> (forall x.
    Rep ListCandidatesForAutoMLJob x -> ListCandidatesForAutoMLJob)
-> Generic ListCandidatesForAutoMLJob
forall x.
Rep ListCandidatesForAutoMLJob x -> ListCandidatesForAutoMLJob
forall x.
ListCandidatesForAutoMLJob -> Rep ListCandidatesForAutoMLJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCandidatesForAutoMLJob x -> ListCandidatesForAutoMLJob
$cfrom :: forall x.
ListCandidatesForAutoMLJob -> Rep ListCandidatesForAutoMLJob x
Prelude.Generic)

-- |
-- Create a value of 'ListCandidatesForAutoMLJob' 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:
--
-- 'candidateNameEquals', 'listCandidatesForAutoMLJob_candidateNameEquals' - List the candidates for the job and filter by candidate name.
--
-- 'nextToken', 'listCandidatesForAutoMLJob_nextToken' - If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
--
-- 'sortOrder', 'listCandidatesForAutoMLJob_sortOrder' - The sort order for the results. The default is @Ascending@.
--
-- 'statusEquals', 'listCandidatesForAutoMLJob_statusEquals' - List the candidates for the job and filter by status.
--
-- 'maxResults', 'listCandidatesForAutoMLJob_maxResults' - List the job\'s candidates up to a specified limit.
--
-- 'sortBy', 'listCandidatesForAutoMLJob_sortBy' - The parameter by which to sort the results. The default is @Descending@.
--
-- 'autoMLJobName', 'listCandidatesForAutoMLJob_autoMLJobName' - List the candidates created for the job by providing the job\'s name.
newListCandidatesForAutoMLJob ::
  -- | 'autoMLJobName'
  Prelude.Text ->
  ListCandidatesForAutoMLJob
newListCandidatesForAutoMLJob :: Text -> ListCandidatesForAutoMLJob
newListCandidatesForAutoMLJob Text
pAutoMLJobName_ =
  ListCandidatesForAutoMLJob' :: Maybe Text
-> Maybe Text
-> Maybe AutoMLSortOrder
-> Maybe CandidateStatus
-> Maybe Natural
-> Maybe CandidateSortBy
-> Text
-> ListCandidatesForAutoMLJob
ListCandidatesForAutoMLJob'
    { $sel:candidateNameEquals:ListCandidatesForAutoMLJob' :: Maybe Text
candidateNameEquals =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCandidatesForAutoMLJob' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListCandidatesForAutoMLJob' :: Maybe AutoMLSortOrder
sortOrder = Maybe AutoMLSortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:statusEquals:ListCandidatesForAutoMLJob' :: Maybe CandidateStatus
statusEquals = Maybe CandidateStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListCandidatesForAutoMLJob' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListCandidatesForAutoMLJob' :: Maybe CandidateSortBy
sortBy = Maybe CandidateSortBy
forall a. Maybe a
Prelude.Nothing,
      $sel:autoMLJobName:ListCandidatesForAutoMLJob' :: Text
autoMLJobName = Text
pAutoMLJobName_
    }

-- | List the candidates for the job and filter by candidate name.
listCandidatesForAutoMLJob_candidateNameEquals :: Lens.Lens' ListCandidatesForAutoMLJob (Prelude.Maybe Prelude.Text)
listCandidatesForAutoMLJob_candidateNameEquals :: (Maybe Text -> f (Maybe Text))
-> ListCandidatesForAutoMLJob -> f ListCandidatesForAutoMLJob
listCandidatesForAutoMLJob_candidateNameEquals = (ListCandidatesForAutoMLJob -> Maybe Text)
-> (ListCandidatesForAutoMLJob
    -> Maybe Text -> ListCandidatesForAutoMLJob)
-> Lens
     ListCandidatesForAutoMLJob
     ListCandidatesForAutoMLJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJob' {Maybe Text
candidateNameEquals :: Maybe Text
$sel:candidateNameEquals:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe Text
candidateNameEquals} -> Maybe Text
candidateNameEquals) (\s :: ListCandidatesForAutoMLJob
s@ListCandidatesForAutoMLJob' {} Maybe Text
a -> ListCandidatesForAutoMLJob
s {$sel:candidateNameEquals:ListCandidatesForAutoMLJob' :: Maybe Text
candidateNameEquals = Maybe Text
a} :: ListCandidatesForAutoMLJob)

-- | If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
listCandidatesForAutoMLJob_nextToken :: Lens.Lens' ListCandidatesForAutoMLJob (Prelude.Maybe Prelude.Text)
listCandidatesForAutoMLJob_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCandidatesForAutoMLJob -> f ListCandidatesForAutoMLJob
listCandidatesForAutoMLJob_nextToken = (ListCandidatesForAutoMLJob -> Maybe Text)
-> (ListCandidatesForAutoMLJob
    -> Maybe Text -> ListCandidatesForAutoMLJob)
-> Lens
     ListCandidatesForAutoMLJob
     ListCandidatesForAutoMLJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJob' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCandidatesForAutoMLJob
s@ListCandidatesForAutoMLJob' {} Maybe Text
a -> ListCandidatesForAutoMLJob
s {$sel:nextToken:ListCandidatesForAutoMLJob' :: Maybe Text
nextToken = Maybe Text
a} :: ListCandidatesForAutoMLJob)

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

-- | List the candidates for the job and filter by status.
listCandidatesForAutoMLJob_statusEquals :: Lens.Lens' ListCandidatesForAutoMLJob (Prelude.Maybe CandidateStatus)
listCandidatesForAutoMLJob_statusEquals :: (Maybe CandidateStatus -> f (Maybe CandidateStatus))
-> ListCandidatesForAutoMLJob -> f ListCandidatesForAutoMLJob
listCandidatesForAutoMLJob_statusEquals = (ListCandidatesForAutoMLJob -> Maybe CandidateStatus)
-> (ListCandidatesForAutoMLJob
    -> Maybe CandidateStatus -> ListCandidatesForAutoMLJob)
-> Lens
     ListCandidatesForAutoMLJob
     ListCandidatesForAutoMLJob
     (Maybe CandidateStatus)
     (Maybe CandidateStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJob' {Maybe CandidateStatus
statusEquals :: Maybe CandidateStatus
$sel:statusEquals:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe CandidateStatus
statusEquals} -> Maybe CandidateStatus
statusEquals) (\s :: ListCandidatesForAutoMLJob
s@ListCandidatesForAutoMLJob' {} Maybe CandidateStatus
a -> ListCandidatesForAutoMLJob
s {$sel:statusEquals:ListCandidatesForAutoMLJob' :: Maybe CandidateStatus
statusEquals = Maybe CandidateStatus
a} :: ListCandidatesForAutoMLJob)

-- | List the job\'s candidates up to a specified limit.
listCandidatesForAutoMLJob_maxResults :: Lens.Lens' ListCandidatesForAutoMLJob (Prelude.Maybe Prelude.Natural)
listCandidatesForAutoMLJob_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListCandidatesForAutoMLJob -> f ListCandidatesForAutoMLJob
listCandidatesForAutoMLJob_maxResults = (ListCandidatesForAutoMLJob -> Maybe Natural)
-> (ListCandidatesForAutoMLJob
    -> Maybe Natural -> ListCandidatesForAutoMLJob)
-> Lens
     ListCandidatesForAutoMLJob
     ListCandidatesForAutoMLJob
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJob' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCandidatesForAutoMLJob
s@ListCandidatesForAutoMLJob' {} Maybe Natural
a -> ListCandidatesForAutoMLJob
s {$sel:maxResults:ListCandidatesForAutoMLJob' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCandidatesForAutoMLJob)

-- | The parameter by which to sort the results. The default is @Descending@.
listCandidatesForAutoMLJob_sortBy :: Lens.Lens' ListCandidatesForAutoMLJob (Prelude.Maybe CandidateSortBy)
listCandidatesForAutoMLJob_sortBy :: (Maybe CandidateSortBy -> f (Maybe CandidateSortBy))
-> ListCandidatesForAutoMLJob -> f ListCandidatesForAutoMLJob
listCandidatesForAutoMLJob_sortBy = (ListCandidatesForAutoMLJob -> Maybe CandidateSortBy)
-> (ListCandidatesForAutoMLJob
    -> Maybe CandidateSortBy -> ListCandidatesForAutoMLJob)
-> Lens
     ListCandidatesForAutoMLJob
     ListCandidatesForAutoMLJob
     (Maybe CandidateSortBy)
     (Maybe CandidateSortBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJob' {Maybe CandidateSortBy
sortBy :: Maybe CandidateSortBy
$sel:sortBy:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe CandidateSortBy
sortBy} -> Maybe CandidateSortBy
sortBy) (\s :: ListCandidatesForAutoMLJob
s@ListCandidatesForAutoMLJob' {} Maybe CandidateSortBy
a -> ListCandidatesForAutoMLJob
s {$sel:sortBy:ListCandidatesForAutoMLJob' :: Maybe CandidateSortBy
sortBy = Maybe CandidateSortBy
a} :: ListCandidatesForAutoMLJob)

-- | List the candidates created for the job by providing the job\'s name.
listCandidatesForAutoMLJob_autoMLJobName :: Lens.Lens' ListCandidatesForAutoMLJob Prelude.Text
listCandidatesForAutoMLJob_autoMLJobName :: (Text -> f Text)
-> ListCandidatesForAutoMLJob -> f ListCandidatesForAutoMLJob
listCandidatesForAutoMLJob_autoMLJobName = (ListCandidatesForAutoMLJob -> Text)
-> (ListCandidatesForAutoMLJob
    -> Text -> ListCandidatesForAutoMLJob)
-> Lens
     ListCandidatesForAutoMLJob ListCandidatesForAutoMLJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJob' {Text
autoMLJobName :: Text
$sel:autoMLJobName:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Text
autoMLJobName} -> Text
autoMLJobName) (\s :: ListCandidatesForAutoMLJob
s@ListCandidatesForAutoMLJob' {} Text
a -> ListCandidatesForAutoMLJob
s {$sel:autoMLJobName:ListCandidatesForAutoMLJob' :: Text
autoMLJobName = Text
a} :: ListCandidatesForAutoMLJob)

instance Core.AWSPager ListCandidatesForAutoMLJob where
  page :: ListCandidatesForAutoMLJob
-> AWSResponse ListCandidatesForAutoMLJob
-> Maybe ListCandidatesForAutoMLJob
page ListCandidatesForAutoMLJob
rq AWSResponse ListCandidatesForAutoMLJob
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListCandidatesForAutoMLJob
ListCandidatesForAutoMLJobResponse
rs
            ListCandidatesForAutoMLJobResponse
-> Getting (First Text) ListCandidatesForAutoMLJobResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListCandidatesForAutoMLJobResponse
-> Const (First Text) ListCandidatesForAutoMLJobResponse
Lens' ListCandidatesForAutoMLJobResponse (Maybe Text)
listCandidatesForAutoMLJobResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListCandidatesForAutoMLJobResponse
 -> Const (First Text) ListCandidatesForAutoMLJobResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListCandidatesForAutoMLJobResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListCandidatesForAutoMLJob
forall a. Maybe a
Prelude.Nothing
    | [AutoMLCandidate] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListCandidatesForAutoMLJob
ListCandidatesForAutoMLJobResponse
rs
            ListCandidatesForAutoMLJobResponse
-> Getting
     [AutoMLCandidate]
     ListCandidatesForAutoMLJobResponse
     [AutoMLCandidate]
-> [AutoMLCandidate]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [AutoMLCandidate]
  ListCandidatesForAutoMLJobResponse
  [AutoMLCandidate]
Lens' ListCandidatesForAutoMLJobResponse [AutoMLCandidate]
listCandidatesForAutoMLJobResponse_candidates
        ) =
      Maybe ListCandidatesForAutoMLJob
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListCandidatesForAutoMLJob -> Maybe ListCandidatesForAutoMLJob
forall a. a -> Maybe a
Prelude.Just (ListCandidatesForAutoMLJob -> Maybe ListCandidatesForAutoMLJob)
-> ListCandidatesForAutoMLJob -> Maybe ListCandidatesForAutoMLJob
forall a b. (a -> b) -> a -> b
Prelude.$
        ListCandidatesForAutoMLJob
rq
          ListCandidatesForAutoMLJob
-> (ListCandidatesForAutoMLJob -> ListCandidatesForAutoMLJob)
-> ListCandidatesForAutoMLJob
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListCandidatesForAutoMLJob
-> Identity ListCandidatesForAutoMLJob
Lens
  ListCandidatesForAutoMLJob
  ListCandidatesForAutoMLJob
  (Maybe Text)
  (Maybe Text)
listCandidatesForAutoMLJob_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListCandidatesForAutoMLJob
 -> Identity ListCandidatesForAutoMLJob)
-> Maybe Text
-> ListCandidatesForAutoMLJob
-> ListCandidatesForAutoMLJob
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListCandidatesForAutoMLJob
ListCandidatesForAutoMLJobResponse
rs
          ListCandidatesForAutoMLJobResponse
-> Getting (First Text) ListCandidatesForAutoMLJobResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListCandidatesForAutoMLJobResponse
-> Const (First Text) ListCandidatesForAutoMLJobResponse
Lens' ListCandidatesForAutoMLJobResponse (Maybe Text)
listCandidatesForAutoMLJobResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListCandidatesForAutoMLJobResponse
 -> Const (First Text) ListCandidatesForAutoMLJobResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListCandidatesForAutoMLJobResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance Prelude.Hashable ListCandidatesForAutoMLJob

instance Prelude.NFData ListCandidatesForAutoMLJob

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

instance Core.ToJSON ListCandidatesForAutoMLJob where
  toJSON :: ListCandidatesForAutoMLJob -> Value
toJSON ListCandidatesForAutoMLJob' {Maybe Natural
Maybe Text
Maybe AutoMLSortOrder
Maybe CandidateSortBy
Maybe CandidateStatus
Text
autoMLJobName :: Text
sortBy :: Maybe CandidateSortBy
maxResults :: Maybe Natural
statusEquals :: Maybe CandidateStatus
sortOrder :: Maybe AutoMLSortOrder
nextToken :: Maybe Text
candidateNameEquals :: Maybe Text
$sel:autoMLJobName:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Text
$sel:sortBy:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe CandidateSortBy
$sel:maxResults:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe Natural
$sel:statusEquals:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe CandidateStatus
$sel:sortOrder:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe AutoMLSortOrder
$sel:nextToken:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe Text
$sel:candidateNameEquals:ListCandidatesForAutoMLJob' :: ListCandidatesForAutoMLJob -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CandidateNameEquals" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
candidateNameEquals,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"SortOrder" Text -> AutoMLSortOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AutoMLSortOrder -> Pair) -> Maybe AutoMLSortOrder -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoMLSortOrder
sortOrder,
            (Text
"StatusEquals" Text -> CandidateStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CandidateStatus -> Pair) -> Maybe CandidateStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CandidateStatus
statusEquals,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"SortBy" Text -> CandidateSortBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CandidateSortBy -> Pair) -> Maybe CandidateSortBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CandidateSortBy
sortBy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AutoMLJobName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
autoMLJobName)
          ]
      )

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

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

-- | /See:/ 'newListCandidatesForAutoMLJobResponse' smart constructor.
data ListCandidatesForAutoMLJobResponse = ListCandidatesForAutoMLJobResponse'
  { -- | If the previous response was truncated, you receive this token. Use it
    -- in your next request to receive the next set of results.
    ListCandidatesForAutoMLJobResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListCandidatesForAutoMLJobResponse -> Int
httpStatus :: Prelude.Int,
    -- | Summaries about the @AutoMLCandidates@.
    ListCandidatesForAutoMLJobResponse -> [AutoMLCandidate]
candidates :: [AutoMLCandidate]
  }
  deriving (ListCandidatesForAutoMLJobResponse
-> ListCandidatesForAutoMLJobResponse -> Bool
(ListCandidatesForAutoMLJobResponse
 -> ListCandidatesForAutoMLJobResponse -> Bool)
-> (ListCandidatesForAutoMLJobResponse
    -> ListCandidatesForAutoMLJobResponse -> Bool)
-> Eq ListCandidatesForAutoMLJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCandidatesForAutoMLJobResponse
-> ListCandidatesForAutoMLJobResponse -> Bool
$c/= :: ListCandidatesForAutoMLJobResponse
-> ListCandidatesForAutoMLJobResponse -> Bool
== :: ListCandidatesForAutoMLJobResponse
-> ListCandidatesForAutoMLJobResponse -> Bool
$c== :: ListCandidatesForAutoMLJobResponse
-> ListCandidatesForAutoMLJobResponse -> Bool
Prelude.Eq, ReadPrec [ListCandidatesForAutoMLJobResponse]
ReadPrec ListCandidatesForAutoMLJobResponse
Int -> ReadS ListCandidatesForAutoMLJobResponse
ReadS [ListCandidatesForAutoMLJobResponse]
(Int -> ReadS ListCandidatesForAutoMLJobResponse)
-> ReadS [ListCandidatesForAutoMLJobResponse]
-> ReadPrec ListCandidatesForAutoMLJobResponse
-> ReadPrec [ListCandidatesForAutoMLJobResponse]
-> Read ListCandidatesForAutoMLJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCandidatesForAutoMLJobResponse]
$creadListPrec :: ReadPrec [ListCandidatesForAutoMLJobResponse]
readPrec :: ReadPrec ListCandidatesForAutoMLJobResponse
$creadPrec :: ReadPrec ListCandidatesForAutoMLJobResponse
readList :: ReadS [ListCandidatesForAutoMLJobResponse]
$creadList :: ReadS [ListCandidatesForAutoMLJobResponse]
readsPrec :: Int -> ReadS ListCandidatesForAutoMLJobResponse
$creadsPrec :: Int -> ReadS ListCandidatesForAutoMLJobResponse
Prelude.Read, Int -> ListCandidatesForAutoMLJobResponse -> ShowS
[ListCandidatesForAutoMLJobResponse] -> ShowS
ListCandidatesForAutoMLJobResponse -> String
(Int -> ListCandidatesForAutoMLJobResponse -> ShowS)
-> (ListCandidatesForAutoMLJobResponse -> String)
-> ([ListCandidatesForAutoMLJobResponse] -> ShowS)
-> Show ListCandidatesForAutoMLJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCandidatesForAutoMLJobResponse] -> ShowS
$cshowList :: [ListCandidatesForAutoMLJobResponse] -> ShowS
show :: ListCandidatesForAutoMLJobResponse -> String
$cshow :: ListCandidatesForAutoMLJobResponse -> String
showsPrec :: Int -> ListCandidatesForAutoMLJobResponse -> ShowS
$cshowsPrec :: Int -> ListCandidatesForAutoMLJobResponse -> ShowS
Prelude.Show, (forall x.
 ListCandidatesForAutoMLJobResponse
 -> Rep ListCandidatesForAutoMLJobResponse x)
-> (forall x.
    Rep ListCandidatesForAutoMLJobResponse x
    -> ListCandidatesForAutoMLJobResponse)
-> Generic ListCandidatesForAutoMLJobResponse
forall x.
Rep ListCandidatesForAutoMLJobResponse x
-> ListCandidatesForAutoMLJobResponse
forall x.
ListCandidatesForAutoMLJobResponse
-> Rep ListCandidatesForAutoMLJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCandidatesForAutoMLJobResponse x
-> ListCandidatesForAutoMLJobResponse
$cfrom :: forall x.
ListCandidatesForAutoMLJobResponse
-> Rep ListCandidatesForAutoMLJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListCandidatesForAutoMLJobResponse' 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', 'listCandidatesForAutoMLJobResponse_nextToken' - If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
--
-- 'httpStatus', 'listCandidatesForAutoMLJobResponse_httpStatus' - The response's http status code.
--
-- 'candidates', 'listCandidatesForAutoMLJobResponse_candidates' - Summaries about the @AutoMLCandidates@.
newListCandidatesForAutoMLJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListCandidatesForAutoMLJobResponse
newListCandidatesForAutoMLJobResponse :: Int -> ListCandidatesForAutoMLJobResponse
newListCandidatesForAutoMLJobResponse Int
pHttpStatus_ =
  ListCandidatesForAutoMLJobResponse' :: Maybe Text
-> Int -> [AutoMLCandidate] -> ListCandidatesForAutoMLJobResponse
ListCandidatesForAutoMLJobResponse'
    { $sel:nextToken:ListCandidatesForAutoMLJobResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListCandidatesForAutoMLJobResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:candidates:ListCandidatesForAutoMLJobResponse' :: [AutoMLCandidate]
candidates = [AutoMLCandidate]
forall a. Monoid a => a
Prelude.mempty
    }

-- | If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
listCandidatesForAutoMLJobResponse_nextToken :: Lens.Lens' ListCandidatesForAutoMLJobResponse (Prelude.Maybe Prelude.Text)
listCandidatesForAutoMLJobResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCandidatesForAutoMLJobResponse
-> f ListCandidatesForAutoMLJobResponse
listCandidatesForAutoMLJobResponse_nextToken = (ListCandidatesForAutoMLJobResponse -> Maybe Text)
-> (ListCandidatesForAutoMLJobResponse
    -> Maybe Text -> ListCandidatesForAutoMLJobResponse)
-> Lens' ListCandidatesForAutoMLJobResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJobResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCandidatesForAutoMLJobResponse' :: ListCandidatesForAutoMLJobResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCandidatesForAutoMLJobResponse
s@ListCandidatesForAutoMLJobResponse' {} Maybe Text
a -> ListCandidatesForAutoMLJobResponse
s {$sel:nextToken:ListCandidatesForAutoMLJobResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCandidatesForAutoMLJobResponse)

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

-- | Summaries about the @AutoMLCandidates@.
listCandidatesForAutoMLJobResponse_candidates :: Lens.Lens' ListCandidatesForAutoMLJobResponse [AutoMLCandidate]
listCandidatesForAutoMLJobResponse_candidates :: ([AutoMLCandidate] -> f [AutoMLCandidate])
-> ListCandidatesForAutoMLJobResponse
-> f ListCandidatesForAutoMLJobResponse
listCandidatesForAutoMLJobResponse_candidates = (ListCandidatesForAutoMLJobResponse -> [AutoMLCandidate])
-> (ListCandidatesForAutoMLJobResponse
    -> [AutoMLCandidate] -> ListCandidatesForAutoMLJobResponse)
-> Lens' ListCandidatesForAutoMLJobResponse [AutoMLCandidate]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCandidatesForAutoMLJobResponse' {[AutoMLCandidate]
candidates :: [AutoMLCandidate]
$sel:candidates:ListCandidatesForAutoMLJobResponse' :: ListCandidatesForAutoMLJobResponse -> [AutoMLCandidate]
candidates} -> [AutoMLCandidate]
candidates) (\s :: ListCandidatesForAutoMLJobResponse
s@ListCandidatesForAutoMLJobResponse' {} [AutoMLCandidate]
a -> ListCandidatesForAutoMLJobResponse
s {$sel:candidates:ListCandidatesForAutoMLJobResponse' :: [AutoMLCandidate]
candidates = [AutoMLCandidate]
a} :: ListCandidatesForAutoMLJobResponse) (([AutoMLCandidate] -> f [AutoMLCandidate])
 -> ListCandidatesForAutoMLJobResponse
 -> f ListCandidatesForAutoMLJobResponse)
-> (([AutoMLCandidate] -> f [AutoMLCandidate])
    -> [AutoMLCandidate] -> f [AutoMLCandidate])
-> ([AutoMLCandidate] -> f [AutoMLCandidate])
-> ListCandidatesForAutoMLJobResponse
-> f ListCandidatesForAutoMLJobResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AutoMLCandidate] -> f [AutoMLCandidate])
-> [AutoMLCandidate] -> f [AutoMLCandidate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListCandidatesForAutoMLJobResponse