{-# 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.ListExperiments
-- 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)
--
-- Lists all the experiments in your account. The list can be filtered to
-- show only experiments that were created in a specific time range. The
-- list can be sorted by experiment name or creation time.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListExperiments
  ( -- * Creating a Request
    ListExperiments (..),
    newListExperiments,

    -- * Request Lenses
    listExperiments_createdAfter,
    listExperiments_nextToken,
    listExperiments_sortOrder,
    listExperiments_maxResults,
    listExperiments_createdBefore,
    listExperiments_sortBy,

    -- * Destructuring the Response
    ListExperimentsResponse (..),
    newListExperimentsResponse,

    -- * Response Lenses
    listExperimentsResponse_experimentSummaries,
    listExperimentsResponse_nextToken,
    listExperimentsResponse_httpStatus,
  )
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:/ 'newListExperiments' smart constructor.
data ListExperiments = ListExperiments'
  { -- | A filter that returns only experiments created after the specified time.
    ListExperiments -> Maybe POSIX
createdAfter :: Prelude.Maybe Core.POSIX,
    -- | If the previous call to @ListExperiments@ didn\'t return the full set of
    -- experiments, the call returns a token for getting the next set of
    -- experiments.
    ListExperiments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order. The default value is @Descending@.
    ListExperiments -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | The maximum number of experiments to return in the response. The default
    -- value is 10.
    ListExperiments -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A filter that returns only experiments created before the specified
    -- time.
    ListExperiments -> Maybe POSIX
createdBefore :: Prelude.Maybe Core.POSIX,
    -- | The property used to sort results. The default value is @CreationTime@.
    ListExperiments -> Maybe SortExperimentsBy
sortBy :: Prelude.Maybe SortExperimentsBy
  }
  deriving (ListExperiments -> ListExperiments -> Bool
(ListExperiments -> ListExperiments -> Bool)
-> (ListExperiments -> ListExperiments -> Bool)
-> Eq ListExperiments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExperiments -> ListExperiments -> Bool
$c/= :: ListExperiments -> ListExperiments -> Bool
== :: ListExperiments -> ListExperiments -> Bool
$c== :: ListExperiments -> ListExperiments -> Bool
Prelude.Eq, ReadPrec [ListExperiments]
ReadPrec ListExperiments
Int -> ReadS ListExperiments
ReadS [ListExperiments]
(Int -> ReadS ListExperiments)
-> ReadS [ListExperiments]
-> ReadPrec ListExperiments
-> ReadPrec [ListExperiments]
-> Read ListExperiments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExperiments]
$creadListPrec :: ReadPrec [ListExperiments]
readPrec :: ReadPrec ListExperiments
$creadPrec :: ReadPrec ListExperiments
readList :: ReadS [ListExperiments]
$creadList :: ReadS [ListExperiments]
readsPrec :: Int -> ReadS ListExperiments
$creadsPrec :: Int -> ReadS ListExperiments
Prelude.Read, Int -> ListExperiments -> ShowS
[ListExperiments] -> ShowS
ListExperiments -> String
(Int -> ListExperiments -> ShowS)
-> (ListExperiments -> String)
-> ([ListExperiments] -> ShowS)
-> Show ListExperiments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExperiments] -> ShowS
$cshowList :: [ListExperiments] -> ShowS
show :: ListExperiments -> String
$cshow :: ListExperiments -> String
showsPrec :: Int -> ListExperiments -> ShowS
$cshowsPrec :: Int -> ListExperiments -> ShowS
Prelude.Show, (forall x. ListExperiments -> Rep ListExperiments x)
-> (forall x. Rep ListExperiments x -> ListExperiments)
-> Generic ListExperiments
forall x. Rep ListExperiments x -> ListExperiments
forall x. ListExperiments -> Rep ListExperiments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExperiments x -> ListExperiments
$cfrom :: forall x. ListExperiments -> Rep ListExperiments x
Prelude.Generic)

-- |
-- Create a value of 'ListExperiments' 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:
--
-- 'createdAfter', 'listExperiments_createdAfter' - A filter that returns only experiments created after the specified time.
--
-- 'nextToken', 'listExperiments_nextToken' - If the previous call to @ListExperiments@ didn\'t return the full set of
-- experiments, the call returns a token for getting the next set of
-- experiments.
--
-- 'sortOrder', 'listExperiments_sortOrder' - The sort order. The default value is @Descending@.
--
-- 'maxResults', 'listExperiments_maxResults' - The maximum number of experiments to return in the response. The default
-- value is 10.
--
-- 'createdBefore', 'listExperiments_createdBefore' - A filter that returns only experiments created before the specified
-- time.
--
-- 'sortBy', 'listExperiments_sortBy' - The property used to sort results. The default value is @CreationTime@.
newListExperiments ::
  ListExperiments
newListExperiments :: ListExperiments
newListExperiments =
  ListExperiments' :: Maybe POSIX
-> Maybe Text
-> Maybe SortOrder
-> Maybe Natural
-> Maybe POSIX
-> Maybe SortExperimentsBy
-> ListExperiments
ListExperiments'
    { $sel:createdAfter:ListExperiments' :: Maybe POSIX
createdAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListExperiments' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListExperiments' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListExperiments' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListExperiments' :: Maybe POSIX
createdBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListExperiments' :: Maybe SortExperimentsBy
sortBy = Maybe SortExperimentsBy
forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns only experiments created after the specified time.
listExperiments_createdAfter :: Lens.Lens' ListExperiments (Prelude.Maybe Prelude.UTCTime)
listExperiments_createdAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListExperiments -> f ListExperiments
listExperiments_createdAfter = (ListExperiments -> Maybe POSIX)
-> (ListExperiments -> Maybe POSIX -> ListExperiments)
-> Lens ListExperiments ListExperiments (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperiments' {Maybe POSIX
createdAfter :: Maybe POSIX
$sel:createdAfter:ListExperiments' :: ListExperiments -> Maybe POSIX
createdAfter} -> Maybe POSIX
createdAfter) (\s :: ListExperiments
s@ListExperiments' {} Maybe POSIX
a -> ListExperiments
s {$sel:createdAfter:ListExperiments' :: Maybe POSIX
createdAfter = Maybe POSIX
a} :: ListExperiments) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListExperiments -> f ListExperiments)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListExperiments
-> f ListExperiments
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | If the previous call to @ListExperiments@ didn\'t return the full set of
-- experiments, the call returns a token for getting the next set of
-- experiments.
listExperiments_nextToken :: Lens.Lens' ListExperiments (Prelude.Maybe Prelude.Text)
listExperiments_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListExperiments -> f ListExperiments
listExperiments_nextToken = (ListExperiments -> Maybe Text)
-> (ListExperiments -> Maybe Text -> ListExperiments)
-> Lens ListExperiments ListExperiments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperiments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExperiments' :: ListExperiments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExperiments
s@ListExperiments' {} Maybe Text
a -> ListExperiments
s {$sel:nextToken:ListExperiments' :: Maybe Text
nextToken = Maybe Text
a} :: ListExperiments)

-- | The sort order. The default value is @Descending@.
listExperiments_sortOrder :: Lens.Lens' ListExperiments (Prelude.Maybe SortOrder)
listExperiments_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListExperiments -> f ListExperiments
listExperiments_sortOrder = (ListExperiments -> Maybe SortOrder)
-> (ListExperiments -> Maybe SortOrder -> ListExperiments)
-> Lens
     ListExperiments ListExperiments (Maybe SortOrder) (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperiments' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListExperiments' :: ListExperiments -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListExperiments
s@ListExperiments' {} Maybe SortOrder
a -> ListExperiments
s {$sel:sortOrder:ListExperiments' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListExperiments)

-- | The maximum number of experiments to return in the response. The default
-- value is 10.
listExperiments_maxResults :: Lens.Lens' ListExperiments (Prelude.Maybe Prelude.Natural)
listExperiments_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListExperiments -> f ListExperiments
listExperiments_maxResults = (ListExperiments -> Maybe Natural)
-> (ListExperiments -> Maybe Natural -> ListExperiments)
-> Lens
     ListExperiments ListExperiments (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperiments' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListExperiments' :: ListExperiments -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListExperiments
s@ListExperiments' {} Maybe Natural
a -> ListExperiments
s {$sel:maxResults:ListExperiments' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListExperiments)

-- | A filter that returns only experiments created before the specified
-- time.
listExperiments_createdBefore :: Lens.Lens' ListExperiments (Prelude.Maybe Prelude.UTCTime)
listExperiments_createdBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListExperiments -> f ListExperiments
listExperiments_createdBefore = (ListExperiments -> Maybe POSIX)
-> (ListExperiments -> Maybe POSIX -> ListExperiments)
-> Lens ListExperiments ListExperiments (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperiments' {Maybe POSIX
createdBefore :: Maybe POSIX
$sel:createdBefore:ListExperiments' :: ListExperiments -> Maybe POSIX
createdBefore} -> Maybe POSIX
createdBefore) (\s :: ListExperiments
s@ListExperiments' {} Maybe POSIX
a -> ListExperiments
s {$sel:createdBefore:ListExperiments' :: Maybe POSIX
createdBefore = Maybe POSIX
a} :: ListExperiments) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListExperiments -> f ListExperiments)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListExperiments
-> f ListExperiments
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The property used to sort results. The default value is @CreationTime@.
listExperiments_sortBy :: Lens.Lens' ListExperiments (Prelude.Maybe SortExperimentsBy)
listExperiments_sortBy :: (Maybe SortExperimentsBy -> f (Maybe SortExperimentsBy))
-> ListExperiments -> f ListExperiments
listExperiments_sortBy = (ListExperiments -> Maybe SortExperimentsBy)
-> (ListExperiments -> Maybe SortExperimentsBy -> ListExperiments)
-> Lens
     ListExperiments
     ListExperiments
     (Maybe SortExperimentsBy)
     (Maybe SortExperimentsBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperiments' {Maybe SortExperimentsBy
sortBy :: Maybe SortExperimentsBy
$sel:sortBy:ListExperiments' :: ListExperiments -> Maybe SortExperimentsBy
sortBy} -> Maybe SortExperimentsBy
sortBy) (\s :: ListExperiments
s@ListExperiments' {} Maybe SortExperimentsBy
a -> ListExperiments
s {$sel:sortBy:ListExperiments' :: Maybe SortExperimentsBy
sortBy = Maybe SortExperimentsBy
a} :: ListExperiments)

instance Core.AWSPager ListExperiments where
  page :: ListExperiments
-> AWSResponse ListExperiments -> Maybe ListExperiments
page ListExperiments
rq AWSResponse ListExperiments
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListExperiments
ListExperimentsResponse
rs
            ListExperimentsResponse
-> Getting (First Text) ListExperimentsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListExperimentsResponse
-> Const (First Text) ListExperimentsResponse
Lens' ListExperimentsResponse (Maybe Text)
listExperimentsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListExperimentsResponse
 -> Const (First Text) ListExperimentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListExperimentsResponse 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 ListExperiments
forall a. Maybe a
Prelude.Nothing
    | Maybe [ExperimentSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListExperiments
ListExperimentsResponse
rs
            ListExperimentsResponse
-> Getting
     (First [ExperimentSummary])
     ListExperimentsResponse
     [ExperimentSummary]
-> Maybe [ExperimentSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ExperimentSummary]
 -> Const (First [ExperimentSummary]) (Maybe [ExperimentSummary]))
-> ListExperimentsResponse
-> Const (First [ExperimentSummary]) ListExperimentsResponse
Lens' ListExperimentsResponse (Maybe [ExperimentSummary])
listExperimentsResponse_experimentSummaries
              ((Maybe [ExperimentSummary]
  -> Const (First [ExperimentSummary]) (Maybe [ExperimentSummary]))
 -> ListExperimentsResponse
 -> Const (First [ExperimentSummary]) ListExperimentsResponse)
-> (([ExperimentSummary]
     -> Const (First [ExperimentSummary]) [ExperimentSummary])
    -> Maybe [ExperimentSummary]
    -> Const (First [ExperimentSummary]) (Maybe [ExperimentSummary]))
-> Getting
     (First [ExperimentSummary])
     ListExperimentsResponse
     [ExperimentSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ExperimentSummary]
 -> Const (First [ExperimentSummary]) [ExperimentSummary])
-> Maybe [ExperimentSummary]
-> Const (First [ExperimentSummary]) (Maybe [ExperimentSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListExperiments
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListExperiments -> Maybe ListExperiments
forall a. a -> Maybe a
Prelude.Just (ListExperiments -> Maybe ListExperiments)
-> ListExperiments -> Maybe ListExperiments
forall a b. (a -> b) -> a -> b
Prelude.$
        ListExperiments
rq
          ListExperiments
-> (ListExperiments -> ListExperiments) -> ListExperiments
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListExperiments -> Identity ListExperiments
Lens ListExperiments ListExperiments (Maybe Text) (Maybe Text)
listExperiments_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListExperiments -> Identity ListExperiments)
-> Maybe Text -> ListExperiments -> ListExperiments
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListExperiments
ListExperimentsResponse
rs
          ListExperimentsResponse
-> Getting (First Text) ListExperimentsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListExperimentsResponse
-> Const (First Text) ListExperimentsResponse
Lens' ListExperimentsResponse (Maybe Text)
listExperimentsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListExperimentsResponse
 -> Const (First Text) ListExperimentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListExperimentsResponse 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 ListExperiments where
  type
    AWSResponse ListExperiments =
      ListExperimentsResponse
  request :: ListExperiments -> Request ListExperiments
request = Service -> ListExperiments -> Request ListExperiments
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListExperiments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListExperiments)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListExperiments))
-> Logger
-> Service
-> Proxy ListExperiments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListExperiments)))
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 [ExperimentSummary]
-> Maybe Text -> Int -> ListExperimentsResponse
ListExperimentsResponse'
            (Maybe [ExperimentSummary]
 -> Maybe Text -> Int -> ListExperimentsResponse)
-> Either String (Maybe [ExperimentSummary])
-> Either String (Maybe Text -> Int -> ListExperimentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ExperimentSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ExperimentSummaries"
                            Either String (Maybe (Maybe [ExperimentSummary]))
-> Maybe [ExperimentSummary]
-> Either String (Maybe [ExperimentSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ExperimentSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListExperimentsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListExperimentsResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> ListExperimentsResponse)
-> Either String Int -> Either String ListExperimentsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListExperiments

instance Prelude.NFData ListExperiments

instance Core.ToHeaders ListExperiments where
  toHeaders :: ListExperiments -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListExperiments -> 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.ListExperiments" :: 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 ListExperiments where
  toJSON :: ListExperiments -> Value
toJSON ListExperiments' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortExperimentsBy
Maybe SortOrder
sortBy :: Maybe SortExperimentsBy
createdBefore :: Maybe POSIX
maxResults :: Maybe Natural
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
createdAfter :: Maybe POSIX
$sel:sortBy:ListExperiments' :: ListExperiments -> Maybe SortExperimentsBy
$sel:createdBefore:ListExperiments' :: ListExperiments -> Maybe POSIX
$sel:maxResults:ListExperiments' :: ListExperiments -> Maybe Natural
$sel:sortOrder:ListExperiments' :: ListExperiments -> Maybe SortOrder
$sel:nextToken:ListExperiments' :: ListExperiments -> Maybe Text
$sel:createdAfter:ListExperiments' :: ListExperiments -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CreatedAfter" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
createdAfter,
            (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 -> SortOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortOrder -> Pair) -> Maybe SortOrder -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrder
sortOrder,
            (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
"CreatedBefore" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
createdBefore,
            (Text
"SortBy" Text -> SortExperimentsBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortExperimentsBy -> Pair)
-> Maybe SortExperimentsBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortExperimentsBy
sortBy
          ]
      )

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

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

-- | /See:/ 'newListExperimentsResponse' smart constructor.
data ListExperimentsResponse = ListExperimentsResponse'
  { -- | A list of the summaries of your experiments.
    ListExperimentsResponse -> Maybe [ExperimentSummary]
experimentSummaries :: Prelude.Maybe [ExperimentSummary],
    -- | A token for getting the next set of experiments, if there are any.
    ListExperimentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListExperimentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListExperimentsResponse -> ListExperimentsResponse -> Bool
(ListExperimentsResponse -> ListExperimentsResponse -> Bool)
-> (ListExperimentsResponse -> ListExperimentsResponse -> Bool)
-> Eq ListExperimentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExperimentsResponse -> ListExperimentsResponse -> Bool
$c/= :: ListExperimentsResponse -> ListExperimentsResponse -> Bool
== :: ListExperimentsResponse -> ListExperimentsResponse -> Bool
$c== :: ListExperimentsResponse -> ListExperimentsResponse -> Bool
Prelude.Eq, ReadPrec [ListExperimentsResponse]
ReadPrec ListExperimentsResponse
Int -> ReadS ListExperimentsResponse
ReadS [ListExperimentsResponse]
(Int -> ReadS ListExperimentsResponse)
-> ReadS [ListExperimentsResponse]
-> ReadPrec ListExperimentsResponse
-> ReadPrec [ListExperimentsResponse]
-> Read ListExperimentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExperimentsResponse]
$creadListPrec :: ReadPrec [ListExperimentsResponse]
readPrec :: ReadPrec ListExperimentsResponse
$creadPrec :: ReadPrec ListExperimentsResponse
readList :: ReadS [ListExperimentsResponse]
$creadList :: ReadS [ListExperimentsResponse]
readsPrec :: Int -> ReadS ListExperimentsResponse
$creadsPrec :: Int -> ReadS ListExperimentsResponse
Prelude.Read, Int -> ListExperimentsResponse -> ShowS
[ListExperimentsResponse] -> ShowS
ListExperimentsResponse -> String
(Int -> ListExperimentsResponse -> ShowS)
-> (ListExperimentsResponse -> String)
-> ([ListExperimentsResponse] -> ShowS)
-> Show ListExperimentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExperimentsResponse] -> ShowS
$cshowList :: [ListExperimentsResponse] -> ShowS
show :: ListExperimentsResponse -> String
$cshow :: ListExperimentsResponse -> String
showsPrec :: Int -> ListExperimentsResponse -> ShowS
$cshowsPrec :: Int -> ListExperimentsResponse -> ShowS
Prelude.Show, (forall x.
 ListExperimentsResponse -> Rep ListExperimentsResponse x)
-> (forall x.
    Rep ListExperimentsResponse x -> ListExperimentsResponse)
-> Generic ListExperimentsResponse
forall x. Rep ListExperimentsResponse x -> ListExperimentsResponse
forall x. ListExperimentsResponse -> Rep ListExperimentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExperimentsResponse x -> ListExperimentsResponse
$cfrom :: forall x. ListExperimentsResponse -> Rep ListExperimentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListExperimentsResponse' 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:
--
-- 'experimentSummaries', 'listExperimentsResponse_experimentSummaries' - A list of the summaries of your experiments.
--
-- 'nextToken', 'listExperimentsResponse_nextToken' - A token for getting the next set of experiments, if there are any.
--
-- 'httpStatus', 'listExperimentsResponse_httpStatus' - The response's http status code.
newListExperimentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListExperimentsResponse
newListExperimentsResponse :: Int -> ListExperimentsResponse
newListExperimentsResponse Int
pHttpStatus_ =
  ListExperimentsResponse' :: Maybe [ExperimentSummary]
-> Maybe Text -> Int -> ListExperimentsResponse
ListExperimentsResponse'
    { $sel:experimentSummaries:ListExperimentsResponse' :: Maybe [ExperimentSummary]
experimentSummaries =
        Maybe [ExperimentSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListExperimentsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListExperimentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of the summaries of your experiments.
listExperimentsResponse_experimentSummaries :: Lens.Lens' ListExperimentsResponse (Prelude.Maybe [ExperimentSummary])
listExperimentsResponse_experimentSummaries :: (Maybe [ExperimentSummary] -> f (Maybe [ExperimentSummary]))
-> ListExperimentsResponse -> f ListExperimentsResponse
listExperimentsResponse_experimentSummaries = (ListExperimentsResponse -> Maybe [ExperimentSummary])
-> (ListExperimentsResponse
    -> Maybe [ExperimentSummary] -> ListExperimentsResponse)
-> Lens' ListExperimentsResponse (Maybe [ExperimentSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperimentsResponse' {Maybe [ExperimentSummary]
experimentSummaries :: Maybe [ExperimentSummary]
$sel:experimentSummaries:ListExperimentsResponse' :: ListExperimentsResponse -> Maybe [ExperimentSummary]
experimentSummaries} -> Maybe [ExperimentSummary]
experimentSummaries) (\s :: ListExperimentsResponse
s@ListExperimentsResponse' {} Maybe [ExperimentSummary]
a -> ListExperimentsResponse
s {$sel:experimentSummaries:ListExperimentsResponse' :: Maybe [ExperimentSummary]
experimentSummaries = Maybe [ExperimentSummary]
a} :: ListExperimentsResponse) ((Maybe [ExperimentSummary] -> f (Maybe [ExperimentSummary]))
 -> ListExperimentsResponse -> f ListExperimentsResponse)
-> ((Maybe [ExperimentSummary] -> f (Maybe [ExperimentSummary]))
    -> Maybe [ExperimentSummary] -> f (Maybe [ExperimentSummary]))
-> (Maybe [ExperimentSummary] -> f (Maybe [ExperimentSummary]))
-> ListExperimentsResponse
-> f ListExperimentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ExperimentSummary]
  [ExperimentSummary]
  [ExperimentSummary]
  [ExperimentSummary]
-> Iso
     (Maybe [ExperimentSummary])
     (Maybe [ExperimentSummary])
     (Maybe [ExperimentSummary])
     (Maybe [ExperimentSummary])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ExperimentSummary]
  [ExperimentSummary]
  [ExperimentSummary]
  [ExperimentSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token for getting the next set of experiments, if there are any.
listExperimentsResponse_nextToken :: Lens.Lens' ListExperimentsResponse (Prelude.Maybe Prelude.Text)
listExperimentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListExperimentsResponse -> f ListExperimentsResponse
listExperimentsResponse_nextToken = (ListExperimentsResponse -> Maybe Text)
-> (ListExperimentsResponse
    -> Maybe Text -> ListExperimentsResponse)
-> Lens' ListExperimentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExperimentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExperimentsResponse' :: ListExperimentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExperimentsResponse
s@ListExperimentsResponse' {} Maybe Text
a -> ListExperimentsResponse
s {$sel:nextToken:ListExperimentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListExperimentsResponse)

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

instance Prelude.NFData ListExperimentsResponse