{-# 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.ListTrials
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the trials in your account. Specify an experiment name to limit
-- the list to the trials that are part of that experiment. Specify a trial
-- component name to limit the list to the trials that associated with that
-- trial component. The list can be filtered to show only trials that were
-- created in a specific time range. The list can be sorted by trial name
-- or creation time.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListTrials
  ( -- * Creating a Request
    ListTrials (..),
    newListTrials,

    -- * Request Lenses
    listTrials_createdAfter,
    listTrials_createdBefore,
    listTrials_experimentName,
    listTrials_maxResults,
    listTrials_nextToken,
    listTrials_sortBy,
    listTrials_sortOrder,
    listTrials_trialComponentName,

    -- * Destructuring the Response
    ListTrialsResponse (..),
    newListTrialsResponse,

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

-- |
-- Create a value of 'ListTrials' 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', 'listTrials_createdAfter' - A filter that returns only trials created after the specified time.
--
-- 'createdBefore', 'listTrials_createdBefore' - A filter that returns only trials created before the specified time.
--
-- 'experimentName', 'listTrials_experimentName' - A filter that returns only trials that are part of the specified
-- experiment.
--
-- 'maxResults', 'listTrials_maxResults' - The maximum number of trials to return in the response. The default
-- value is 10.
--
-- 'nextToken', 'listTrials_nextToken' - If the previous call to @ListTrials@ didn\'t return the full set of
-- trials, the call returns a token for getting the next set of trials.
--
-- 'sortBy', 'listTrials_sortBy' - The property used to sort results. The default value is @CreationTime@.
--
-- 'sortOrder', 'listTrials_sortOrder' - The sort order. The default value is @Descending@.
--
-- 'trialComponentName', 'listTrials_trialComponentName' - A filter that returns only trials that are associated with the specified
-- trial component.
newListTrials ::
  ListTrials
newListTrials :: ListTrials
newListTrials =
  ListTrials'
    { $sel:createdAfter:ListTrials' :: Maybe POSIX
createdAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListTrials' :: Maybe POSIX
createdBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:experimentName:ListTrials' :: Maybe Text
experimentName = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListTrials' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTrials' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListTrials' :: Maybe SortTrialsBy
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListTrials' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:trialComponentName:ListTrials' :: Maybe Text
trialComponentName = forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | A filter that returns only trials that are part of the specified
-- experiment.
listTrials_experimentName :: Lens.Lens' ListTrials (Prelude.Maybe Prelude.Text)
listTrials_experimentName :: Lens' ListTrials (Maybe Text)
listTrials_experimentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrials' {Maybe Text
experimentName :: Maybe Text
$sel:experimentName:ListTrials' :: ListTrials -> Maybe Text
experimentName} -> Maybe Text
experimentName) (\s :: ListTrials
s@ListTrials' {} Maybe Text
a -> ListTrials
s {$sel:experimentName:ListTrials' :: Maybe Text
experimentName = Maybe Text
a} :: ListTrials)

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

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

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

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

-- | A filter that returns only trials that are associated with the specified
-- trial component.
listTrials_trialComponentName :: Lens.Lens' ListTrials (Prelude.Maybe Prelude.Text)
listTrials_trialComponentName :: Lens' ListTrials (Maybe Text)
listTrials_trialComponentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrials' {Maybe Text
trialComponentName :: Maybe Text
$sel:trialComponentName:ListTrials' :: ListTrials -> Maybe Text
trialComponentName} -> Maybe Text
trialComponentName) (\s :: ListTrials
s@ListTrials' {} Maybe Text
a -> ListTrials
s {$sel:trialComponentName:ListTrials' :: Maybe Text
trialComponentName = Maybe Text
a} :: ListTrials)

instance Core.AWSPager ListTrials where
  page :: ListTrials -> AWSResponse ListTrials -> Maybe ListTrials
page ListTrials
rq AWSResponse ListTrials
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTrials
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTrialsResponse (Maybe Text)
listTrialsResponse_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 ListTrials
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTrialsResponse (Maybe [TrialSummary])
listTrialsResponse_trialSummaries
            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
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListTrials
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListTrials (Maybe Text)
listTrials_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTrials
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTrialsResponse (Maybe Text)
listTrialsResponse_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 ListTrials where
  type AWSResponse ListTrials = ListTrialsResponse
  request :: (Service -> Service) -> ListTrials -> Request ListTrials
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 ListTrials
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTrials)))
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 -> Maybe [TrialSummary] -> Int -> ListTrialsResponse
ListTrialsResponse'
            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TrialSummaries" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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))
      )

instance Prelude.Hashable ListTrials where
  hashWithSalt :: Int -> ListTrials -> Int
hashWithSalt Int
_salt ListTrials' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortOrder
Maybe SortTrialsBy
trialComponentName :: Maybe Text
sortOrder :: Maybe SortOrder
sortBy :: Maybe SortTrialsBy
nextToken :: Maybe Text
maxResults :: Maybe Natural
experimentName :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
$sel:trialComponentName:ListTrials' :: ListTrials -> Maybe Text
$sel:sortOrder:ListTrials' :: ListTrials -> Maybe SortOrder
$sel:sortBy:ListTrials' :: ListTrials -> Maybe SortTrialsBy
$sel:nextToken:ListTrials' :: ListTrials -> Maybe Text
$sel:maxResults:ListTrials' :: ListTrials -> Maybe Natural
$sel:experimentName:ListTrials' :: ListTrials -> Maybe Text
$sel:createdBefore:ListTrials' :: ListTrials -> Maybe POSIX
$sel:createdAfter:ListTrials' :: ListTrials -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
experimentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortTrialsBy
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trialComponentName

instance Prelude.NFData ListTrials where
  rnf :: ListTrials -> ()
rnf ListTrials' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortOrder
Maybe SortTrialsBy
trialComponentName :: Maybe Text
sortOrder :: Maybe SortOrder
sortBy :: Maybe SortTrialsBy
nextToken :: Maybe Text
maxResults :: Maybe Natural
experimentName :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
$sel:trialComponentName:ListTrials' :: ListTrials -> Maybe Text
$sel:sortOrder:ListTrials' :: ListTrials -> Maybe SortOrder
$sel:sortBy:ListTrials' :: ListTrials -> Maybe SortTrialsBy
$sel:nextToken:ListTrials' :: ListTrials -> Maybe Text
$sel:maxResults:ListTrials' :: ListTrials -> Maybe Natural
$sel:experimentName:ListTrials' :: ListTrials -> Maybe Text
$sel:createdBefore:ListTrials' :: ListTrials -> Maybe POSIX
$sel:createdAfter:ListTrials' :: ListTrials -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
experimentName
      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
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortTrialsBy
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 Text
trialComponentName

instance Data.ToHeaders ListTrials where
  toHeaders :: ListTrials -> 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.ListTrials" :: 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 ListTrials where
  toJSON :: ListTrials -> Value
toJSON ListTrials' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortOrder
Maybe SortTrialsBy
trialComponentName :: Maybe Text
sortOrder :: Maybe SortOrder
sortBy :: Maybe SortTrialsBy
nextToken :: Maybe Text
maxResults :: Maybe Natural
experimentName :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
$sel:trialComponentName:ListTrials' :: ListTrials -> Maybe Text
$sel:sortOrder:ListTrials' :: ListTrials -> Maybe SortOrder
$sel:sortBy:ListTrials' :: ListTrials -> Maybe SortTrialsBy
$sel:nextToken:ListTrials' :: ListTrials -> Maybe Text
$sel:maxResults:ListTrials' :: ListTrials -> Maybe Natural
$sel:experimentName:ListTrials' :: ListTrials -> Maybe Text
$sel:createdBefore:ListTrials' :: ListTrials -> Maybe POSIX
$sel:createdAfter:ListTrials' :: ListTrials -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CreatedAfter" 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
createdAfter,
            (Key
"CreatedBefore" 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
createdBefore,
            (Key
"ExperimentName" 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
experimentName,
            (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
"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 SortTrialsBy
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
"TrialComponentName" 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
trialComponentName
          ]
      )

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

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

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

-- |
-- Create a value of 'ListTrialsResponse' 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', 'listTrialsResponse_nextToken' - A token for getting the next set of trials, if there are any.
--
-- 'trialSummaries', 'listTrialsResponse_trialSummaries' - A list of the summaries of your trials.
--
-- 'httpStatus', 'listTrialsResponse_httpStatus' - The response's http status code.
newListTrialsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTrialsResponse
newListTrialsResponse :: Int -> ListTrialsResponse
newListTrialsResponse Int
pHttpStatus_ =
  ListTrialsResponse'
    { $sel:nextToken:ListTrialsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:trialSummaries:ListTrialsResponse' :: Maybe [TrialSummary]
trialSummaries = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTrialsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | A list of the summaries of your trials.
listTrialsResponse_trialSummaries :: Lens.Lens' ListTrialsResponse (Prelude.Maybe [TrialSummary])
listTrialsResponse_trialSummaries :: Lens' ListTrialsResponse (Maybe [TrialSummary])
listTrialsResponse_trialSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrialsResponse' {Maybe [TrialSummary]
trialSummaries :: Maybe [TrialSummary]
$sel:trialSummaries:ListTrialsResponse' :: ListTrialsResponse -> Maybe [TrialSummary]
trialSummaries} -> Maybe [TrialSummary]
trialSummaries) (\s :: ListTrialsResponse
s@ListTrialsResponse' {} Maybe [TrialSummary]
a -> ListTrialsResponse
s {$sel:trialSummaries:ListTrialsResponse' :: Maybe [TrialSummary]
trialSummaries = Maybe [TrialSummary]
a} :: ListTrialsResponse) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListTrialsResponse where
  rnf :: ListTrialsResponse -> ()
rnf ListTrialsResponse' {Int
Maybe [TrialSummary]
Maybe Text
httpStatus :: Int
trialSummaries :: Maybe [TrialSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListTrialsResponse' :: ListTrialsResponse -> Int
$sel:trialSummaries:ListTrialsResponse' :: ListTrialsResponse -> Maybe [TrialSummary]
$sel:nextToken:ListTrialsResponse' :: ListTrialsResponse -> 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 Maybe [TrialSummary]
trialSummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus