{-# 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.ListPipelines
-- 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)
--
-- Gets a list of pipelines.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListPipelines
  ( -- * Creating a Request
    ListPipelines (..),
    newListPipelines,

    -- * Request Lenses
    listPipelines_createdAfter,
    listPipelines_pipelineNamePrefix,
    listPipelines_nextToken,
    listPipelines_sortOrder,
    listPipelines_maxResults,
    listPipelines_createdBefore,
    listPipelines_sortBy,

    -- * Destructuring the Response
    ListPipelinesResponse (..),
    newListPipelinesResponse,

    -- * Response Lenses
    listPipelinesResponse_pipelineSummaries,
    listPipelinesResponse_nextToken,
    listPipelinesResponse_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:/ 'newListPipelines' smart constructor.
data ListPipelines = ListPipelines'
  { -- | A filter that returns the pipelines that were created after a specified
    -- time.
    ListPipelines -> Maybe POSIX
createdAfter :: Prelude.Maybe Core.POSIX,
    -- | The prefix of the pipeline name.
    ListPipelines -> Maybe Text
pipelineNamePrefix :: Prelude.Maybe Prelude.Text,
    -- | If the result of the previous @ListPipelines@ request was truncated, the
    -- response includes a @NextToken@. To retrieve the next set of pipelines,
    -- use the token in the next request.
    ListPipelines -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order for results.
    ListPipelines -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | The maximum number of pipelines to return in the response.
    ListPipelines -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A filter that returns the pipelines that were created before a specified
    -- time.
    ListPipelines -> Maybe POSIX
createdBefore :: Prelude.Maybe Core.POSIX,
    -- | The field by which to sort results. The default is @CreatedTime@.
    ListPipelines -> Maybe SortPipelinesBy
sortBy :: Prelude.Maybe SortPipelinesBy
  }
  deriving (ListPipelines -> ListPipelines -> Bool
(ListPipelines -> ListPipelines -> Bool)
-> (ListPipelines -> ListPipelines -> Bool) -> Eq ListPipelines
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPipelines -> ListPipelines -> Bool
$c/= :: ListPipelines -> ListPipelines -> Bool
== :: ListPipelines -> ListPipelines -> Bool
$c== :: ListPipelines -> ListPipelines -> Bool
Prelude.Eq, ReadPrec [ListPipelines]
ReadPrec ListPipelines
Int -> ReadS ListPipelines
ReadS [ListPipelines]
(Int -> ReadS ListPipelines)
-> ReadS [ListPipelines]
-> ReadPrec ListPipelines
-> ReadPrec [ListPipelines]
-> Read ListPipelines
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPipelines]
$creadListPrec :: ReadPrec [ListPipelines]
readPrec :: ReadPrec ListPipelines
$creadPrec :: ReadPrec ListPipelines
readList :: ReadS [ListPipelines]
$creadList :: ReadS [ListPipelines]
readsPrec :: Int -> ReadS ListPipelines
$creadsPrec :: Int -> ReadS ListPipelines
Prelude.Read, Int -> ListPipelines -> ShowS
[ListPipelines] -> ShowS
ListPipelines -> String
(Int -> ListPipelines -> ShowS)
-> (ListPipelines -> String)
-> ([ListPipelines] -> ShowS)
-> Show ListPipelines
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPipelines] -> ShowS
$cshowList :: [ListPipelines] -> ShowS
show :: ListPipelines -> String
$cshow :: ListPipelines -> String
showsPrec :: Int -> ListPipelines -> ShowS
$cshowsPrec :: Int -> ListPipelines -> ShowS
Prelude.Show, (forall x. ListPipelines -> Rep ListPipelines x)
-> (forall x. Rep ListPipelines x -> ListPipelines)
-> Generic ListPipelines
forall x. Rep ListPipelines x -> ListPipelines
forall x. ListPipelines -> Rep ListPipelines x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPipelines x -> ListPipelines
$cfrom :: forall x. ListPipelines -> Rep ListPipelines x
Prelude.Generic)

-- |
-- Create a value of 'ListPipelines' 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', 'listPipelines_createdAfter' - A filter that returns the pipelines that were created after a specified
-- time.
--
-- 'pipelineNamePrefix', 'listPipelines_pipelineNamePrefix' - The prefix of the pipeline name.
--
-- 'nextToken', 'listPipelines_nextToken' - If the result of the previous @ListPipelines@ request was truncated, the
-- response includes a @NextToken@. To retrieve the next set of pipelines,
-- use the token in the next request.
--
-- 'sortOrder', 'listPipelines_sortOrder' - The sort order for results.
--
-- 'maxResults', 'listPipelines_maxResults' - The maximum number of pipelines to return in the response.
--
-- 'createdBefore', 'listPipelines_createdBefore' - A filter that returns the pipelines that were created before a specified
-- time.
--
-- 'sortBy', 'listPipelines_sortBy' - The field by which to sort results. The default is @CreatedTime@.
newListPipelines ::
  ListPipelines
newListPipelines :: ListPipelines
newListPipelines =
  ListPipelines' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe SortOrder
-> Maybe Natural
-> Maybe POSIX
-> Maybe SortPipelinesBy
-> ListPipelines
ListPipelines'
    { $sel:createdAfter:ListPipelines' :: Maybe POSIX
createdAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineNamePrefix:ListPipelines' :: Maybe Text
pipelineNamePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPipelines' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListPipelines' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPipelines' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListPipelines' :: Maybe POSIX
createdBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListPipelines' :: Maybe SortPipelinesBy
sortBy = Maybe SortPipelinesBy
forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns the pipelines that were created after a specified
-- time.
listPipelines_createdAfter :: Lens.Lens' ListPipelines (Prelude.Maybe Prelude.UTCTime)
listPipelines_createdAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPipelines -> f ListPipelines
listPipelines_createdAfter = (ListPipelines -> Maybe POSIX)
-> (ListPipelines -> Maybe POSIX -> ListPipelines)
-> Lens ListPipelines ListPipelines (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPipelines' {Maybe POSIX
createdAfter :: Maybe POSIX
$sel:createdAfter:ListPipelines' :: ListPipelines -> Maybe POSIX
createdAfter} -> Maybe POSIX
createdAfter) (\s :: ListPipelines
s@ListPipelines' {} Maybe POSIX
a -> ListPipelines
s {$sel:createdAfter:ListPipelines' :: Maybe POSIX
createdAfter = Maybe POSIX
a} :: ListPipelines) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListPipelines -> f ListPipelines)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPipelines
-> f ListPipelines
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 prefix of the pipeline name.
listPipelines_pipelineNamePrefix :: Lens.Lens' ListPipelines (Prelude.Maybe Prelude.Text)
listPipelines_pipelineNamePrefix :: (Maybe Text -> f (Maybe Text)) -> ListPipelines -> f ListPipelines
listPipelines_pipelineNamePrefix = (ListPipelines -> Maybe Text)
-> (ListPipelines -> Maybe Text -> ListPipelines)
-> Lens ListPipelines ListPipelines (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPipelines' {Maybe Text
pipelineNamePrefix :: Maybe Text
$sel:pipelineNamePrefix:ListPipelines' :: ListPipelines -> Maybe Text
pipelineNamePrefix} -> Maybe Text
pipelineNamePrefix) (\s :: ListPipelines
s@ListPipelines' {} Maybe Text
a -> ListPipelines
s {$sel:pipelineNamePrefix:ListPipelines' :: Maybe Text
pipelineNamePrefix = Maybe Text
a} :: ListPipelines)

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

-- | The sort order for results.
listPipelines_sortOrder :: Lens.Lens' ListPipelines (Prelude.Maybe SortOrder)
listPipelines_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListPipelines -> f ListPipelines
listPipelines_sortOrder = (ListPipelines -> Maybe SortOrder)
-> (ListPipelines -> Maybe SortOrder -> ListPipelines)
-> Lens
     ListPipelines ListPipelines (Maybe SortOrder) (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPipelines' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListPipelines' :: ListPipelines -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListPipelines
s@ListPipelines' {} Maybe SortOrder
a -> ListPipelines
s {$sel:sortOrder:ListPipelines' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListPipelines)

-- | The maximum number of pipelines to return in the response.
listPipelines_maxResults :: Lens.Lens' ListPipelines (Prelude.Maybe Prelude.Natural)
listPipelines_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPipelines -> f ListPipelines
listPipelines_maxResults = (ListPipelines -> Maybe Natural)
-> (ListPipelines -> Maybe Natural -> ListPipelines)
-> Lens ListPipelines ListPipelines (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPipelines' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPipelines' :: ListPipelines -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPipelines
s@ListPipelines' {} Maybe Natural
a -> ListPipelines
s {$sel:maxResults:ListPipelines' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPipelines)

-- | A filter that returns the pipelines that were created before a specified
-- time.
listPipelines_createdBefore :: Lens.Lens' ListPipelines (Prelude.Maybe Prelude.UTCTime)
listPipelines_createdBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPipelines -> f ListPipelines
listPipelines_createdBefore = (ListPipelines -> Maybe POSIX)
-> (ListPipelines -> Maybe POSIX -> ListPipelines)
-> Lens ListPipelines ListPipelines (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPipelines' {Maybe POSIX
createdBefore :: Maybe POSIX
$sel:createdBefore:ListPipelines' :: ListPipelines -> Maybe POSIX
createdBefore} -> Maybe POSIX
createdBefore) (\s :: ListPipelines
s@ListPipelines' {} Maybe POSIX
a -> ListPipelines
s {$sel:createdBefore:ListPipelines' :: Maybe POSIX
createdBefore = Maybe POSIX
a} :: ListPipelines) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListPipelines -> f ListPipelines)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPipelines
-> f ListPipelines
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 field by which to sort results. The default is @CreatedTime@.
listPipelines_sortBy :: Lens.Lens' ListPipelines (Prelude.Maybe SortPipelinesBy)
listPipelines_sortBy :: (Maybe SortPipelinesBy -> f (Maybe SortPipelinesBy))
-> ListPipelines -> f ListPipelines
listPipelines_sortBy = (ListPipelines -> Maybe SortPipelinesBy)
-> (ListPipelines -> Maybe SortPipelinesBy -> ListPipelines)
-> Lens
     ListPipelines
     ListPipelines
     (Maybe SortPipelinesBy)
     (Maybe SortPipelinesBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPipelines' {Maybe SortPipelinesBy
sortBy :: Maybe SortPipelinesBy
$sel:sortBy:ListPipelines' :: ListPipelines -> Maybe SortPipelinesBy
sortBy} -> Maybe SortPipelinesBy
sortBy) (\s :: ListPipelines
s@ListPipelines' {} Maybe SortPipelinesBy
a -> ListPipelines
s {$sel:sortBy:ListPipelines' :: Maybe SortPipelinesBy
sortBy = Maybe SortPipelinesBy
a} :: ListPipelines)

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

instance Prelude.NFData ListPipelines

instance Core.ToHeaders ListPipelines where
  toHeaders :: ListPipelines -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListPipelines -> 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.ListPipelines" :: 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 ListPipelines where
  toJSON :: ListPipelines -> Value
toJSON ListPipelines' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortOrder
Maybe SortPipelinesBy
sortBy :: Maybe SortPipelinesBy
createdBefore :: Maybe POSIX
maxResults :: Maybe Natural
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
pipelineNamePrefix :: Maybe Text
createdAfter :: Maybe POSIX
$sel:sortBy:ListPipelines' :: ListPipelines -> Maybe SortPipelinesBy
$sel:createdBefore:ListPipelines' :: ListPipelines -> Maybe POSIX
$sel:maxResults:ListPipelines' :: ListPipelines -> Maybe Natural
$sel:sortOrder:ListPipelines' :: ListPipelines -> Maybe SortOrder
$sel:nextToken:ListPipelines' :: ListPipelines -> Maybe Text
$sel:pipelineNamePrefix:ListPipelines' :: ListPipelines -> Maybe Text
$sel:createdAfter:ListPipelines' :: ListPipelines -> 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
"PipelineNamePrefix" 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
pipelineNamePrefix,
            (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 -> SortPipelinesBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortPipelinesBy -> Pair) -> Maybe SortPipelinesBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortPipelinesBy
sortBy
          ]
      )

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

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

-- | /See:/ 'newListPipelinesResponse' smart constructor.
data ListPipelinesResponse = ListPipelinesResponse'
  { -- | Contains a sorted list of @PipelineSummary@ objects matching the
    -- specified filters. Each @PipelineSummary@ consists of PipelineArn,
    -- PipelineName, ExperimentName, PipelineDescription, CreationTime,
    -- LastModifiedTime, LastRunTime, and RoleArn. This list can be empty.
    ListPipelinesResponse -> Maybe [PipelineSummary]
pipelineSummaries :: Prelude.Maybe [PipelineSummary],
    -- | If the result of the previous @ListPipelines@ request was truncated, the
    -- response includes a @NextToken@. To retrieve the next set of pipelines,
    -- use the token in the next request.
    ListPipelinesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPipelinesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPipelinesResponse -> ListPipelinesResponse -> Bool
(ListPipelinesResponse -> ListPipelinesResponse -> Bool)
-> (ListPipelinesResponse -> ListPipelinesResponse -> Bool)
-> Eq ListPipelinesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPipelinesResponse -> ListPipelinesResponse -> Bool
$c/= :: ListPipelinesResponse -> ListPipelinesResponse -> Bool
== :: ListPipelinesResponse -> ListPipelinesResponse -> Bool
$c== :: ListPipelinesResponse -> ListPipelinesResponse -> Bool
Prelude.Eq, ReadPrec [ListPipelinesResponse]
ReadPrec ListPipelinesResponse
Int -> ReadS ListPipelinesResponse
ReadS [ListPipelinesResponse]
(Int -> ReadS ListPipelinesResponse)
-> ReadS [ListPipelinesResponse]
-> ReadPrec ListPipelinesResponse
-> ReadPrec [ListPipelinesResponse]
-> Read ListPipelinesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPipelinesResponse]
$creadListPrec :: ReadPrec [ListPipelinesResponse]
readPrec :: ReadPrec ListPipelinesResponse
$creadPrec :: ReadPrec ListPipelinesResponse
readList :: ReadS [ListPipelinesResponse]
$creadList :: ReadS [ListPipelinesResponse]
readsPrec :: Int -> ReadS ListPipelinesResponse
$creadsPrec :: Int -> ReadS ListPipelinesResponse
Prelude.Read, Int -> ListPipelinesResponse -> ShowS
[ListPipelinesResponse] -> ShowS
ListPipelinesResponse -> String
(Int -> ListPipelinesResponse -> ShowS)
-> (ListPipelinesResponse -> String)
-> ([ListPipelinesResponse] -> ShowS)
-> Show ListPipelinesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPipelinesResponse] -> ShowS
$cshowList :: [ListPipelinesResponse] -> ShowS
show :: ListPipelinesResponse -> String
$cshow :: ListPipelinesResponse -> String
showsPrec :: Int -> ListPipelinesResponse -> ShowS
$cshowsPrec :: Int -> ListPipelinesResponse -> ShowS
Prelude.Show, (forall x. ListPipelinesResponse -> Rep ListPipelinesResponse x)
-> (forall x. Rep ListPipelinesResponse x -> ListPipelinesResponse)
-> Generic ListPipelinesResponse
forall x. Rep ListPipelinesResponse x -> ListPipelinesResponse
forall x. ListPipelinesResponse -> Rep ListPipelinesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPipelinesResponse x -> ListPipelinesResponse
$cfrom :: forall x. ListPipelinesResponse -> Rep ListPipelinesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPipelinesResponse' 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:
--
-- 'pipelineSummaries', 'listPipelinesResponse_pipelineSummaries' - Contains a sorted list of @PipelineSummary@ objects matching the
-- specified filters. Each @PipelineSummary@ consists of PipelineArn,
-- PipelineName, ExperimentName, PipelineDescription, CreationTime,
-- LastModifiedTime, LastRunTime, and RoleArn. This list can be empty.
--
-- 'nextToken', 'listPipelinesResponse_nextToken' - If the result of the previous @ListPipelines@ request was truncated, the
-- response includes a @NextToken@. To retrieve the next set of pipelines,
-- use the token in the next request.
--
-- 'httpStatus', 'listPipelinesResponse_httpStatus' - The response's http status code.
newListPipelinesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPipelinesResponse
newListPipelinesResponse :: Int -> ListPipelinesResponse
newListPipelinesResponse Int
pHttpStatus_ =
  ListPipelinesResponse' :: Maybe [PipelineSummary]
-> Maybe Text -> Int -> ListPipelinesResponse
ListPipelinesResponse'
    { $sel:pipelineSummaries:ListPipelinesResponse' :: Maybe [PipelineSummary]
pipelineSummaries =
        Maybe [PipelineSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPipelinesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPipelinesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Contains a sorted list of @PipelineSummary@ objects matching the
-- specified filters. Each @PipelineSummary@ consists of PipelineArn,
-- PipelineName, ExperimentName, PipelineDescription, CreationTime,
-- LastModifiedTime, LastRunTime, and RoleArn. This list can be empty.
listPipelinesResponse_pipelineSummaries :: Lens.Lens' ListPipelinesResponse (Prelude.Maybe [PipelineSummary])
listPipelinesResponse_pipelineSummaries :: (Maybe [PipelineSummary] -> f (Maybe [PipelineSummary]))
-> ListPipelinesResponse -> f ListPipelinesResponse
listPipelinesResponse_pipelineSummaries = (ListPipelinesResponse -> Maybe [PipelineSummary])
-> (ListPipelinesResponse
    -> Maybe [PipelineSummary] -> ListPipelinesResponse)
-> Lens' ListPipelinesResponse (Maybe [PipelineSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPipelinesResponse' {Maybe [PipelineSummary]
pipelineSummaries :: Maybe [PipelineSummary]
$sel:pipelineSummaries:ListPipelinesResponse' :: ListPipelinesResponse -> Maybe [PipelineSummary]
pipelineSummaries} -> Maybe [PipelineSummary]
pipelineSummaries) (\s :: ListPipelinesResponse
s@ListPipelinesResponse' {} Maybe [PipelineSummary]
a -> ListPipelinesResponse
s {$sel:pipelineSummaries:ListPipelinesResponse' :: Maybe [PipelineSummary]
pipelineSummaries = Maybe [PipelineSummary]
a} :: ListPipelinesResponse) ((Maybe [PipelineSummary] -> f (Maybe [PipelineSummary]))
 -> ListPipelinesResponse -> f ListPipelinesResponse)
-> ((Maybe [PipelineSummary] -> f (Maybe [PipelineSummary]))
    -> Maybe [PipelineSummary] -> f (Maybe [PipelineSummary]))
-> (Maybe [PipelineSummary] -> f (Maybe [PipelineSummary]))
-> ListPipelinesResponse
-> f ListPipelinesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PipelineSummary]
  [PipelineSummary]
  [PipelineSummary]
  [PipelineSummary]
-> Iso
     (Maybe [PipelineSummary])
     (Maybe [PipelineSummary])
     (Maybe [PipelineSummary])
     (Maybe [PipelineSummary])
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
  [PipelineSummary]
  [PipelineSummary]
  [PipelineSummary]
  [PipelineSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData ListPipelinesResponse