{-# 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.ListFlowDefinitions
-- 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)
--
-- Returns information about the flow definitions in your account.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListFlowDefinitions
  ( -- * Creating a Request
    ListFlowDefinitions (..),
    newListFlowDefinitions,

    -- * Request Lenses
    listFlowDefinitions_creationTimeAfter,
    listFlowDefinitions_nextToken,
    listFlowDefinitions_sortOrder,
    listFlowDefinitions_creationTimeBefore,
    listFlowDefinitions_maxResults,

    -- * Destructuring the Response
    ListFlowDefinitionsResponse (..),
    newListFlowDefinitionsResponse,

    -- * Response Lenses
    listFlowDefinitionsResponse_nextToken,
    listFlowDefinitionsResponse_httpStatus,
    listFlowDefinitionsResponse_flowDefinitionSummaries,
  )
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:/ 'newListFlowDefinitions' smart constructor.
data ListFlowDefinitions = ListFlowDefinitions'
  { -- | A filter that returns only flow definitions with a creation time greater
    -- than or equal to the specified timestamp.
    ListFlowDefinitions -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Core.POSIX,
    -- | A token to resume pagination.
    ListFlowDefinitions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An optional value that specifies whether you want the results sorted in
    -- @Ascending@ or @Descending@ order.
    ListFlowDefinitions -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | A filter that returns only flow definitions that were created before the
    -- specified timestamp.
    ListFlowDefinitions -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Core.POSIX,
    -- | The total number of items to return. If the total number of available
    -- items is more than the value specified in @MaxResults@, then a
    -- @NextToken@ will be provided in the output that you can use to resume
    -- pagination.
    ListFlowDefinitions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListFlowDefinitions -> ListFlowDefinitions -> Bool
(ListFlowDefinitions -> ListFlowDefinitions -> Bool)
-> (ListFlowDefinitions -> ListFlowDefinitions -> Bool)
-> Eq ListFlowDefinitions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFlowDefinitions -> ListFlowDefinitions -> Bool
$c/= :: ListFlowDefinitions -> ListFlowDefinitions -> Bool
== :: ListFlowDefinitions -> ListFlowDefinitions -> Bool
$c== :: ListFlowDefinitions -> ListFlowDefinitions -> Bool
Prelude.Eq, ReadPrec [ListFlowDefinitions]
ReadPrec ListFlowDefinitions
Int -> ReadS ListFlowDefinitions
ReadS [ListFlowDefinitions]
(Int -> ReadS ListFlowDefinitions)
-> ReadS [ListFlowDefinitions]
-> ReadPrec ListFlowDefinitions
-> ReadPrec [ListFlowDefinitions]
-> Read ListFlowDefinitions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFlowDefinitions]
$creadListPrec :: ReadPrec [ListFlowDefinitions]
readPrec :: ReadPrec ListFlowDefinitions
$creadPrec :: ReadPrec ListFlowDefinitions
readList :: ReadS [ListFlowDefinitions]
$creadList :: ReadS [ListFlowDefinitions]
readsPrec :: Int -> ReadS ListFlowDefinitions
$creadsPrec :: Int -> ReadS ListFlowDefinitions
Prelude.Read, Int -> ListFlowDefinitions -> ShowS
[ListFlowDefinitions] -> ShowS
ListFlowDefinitions -> String
(Int -> ListFlowDefinitions -> ShowS)
-> (ListFlowDefinitions -> String)
-> ([ListFlowDefinitions] -> ShowS)
-> Show ListFlowDefinitions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFlowDefinitions] -> ShowS
$cshowList :: [ListFlowDefinitions] -> ShowS
show :: ListFlowDefinitions -> String
$cshow :: ListFlowDefinitions -> String
showsPrec :: Int -> ListFlowDefinitions -> ShowS
$cshowsPrec :: Int -> ListFlowDefinitions -> ShowS
Prelude.Show, (forall x. ListFlowDefinitions -> Rep ListFlowDefinitions x)
-> (forall x. Rep ListFlowDefinitions x -> ListFlowDefinitions)
-> Generic ListFlowDefinitions
forall x. Rep ListFlowDefinitions x -> ListFlowDefinitions
forall x. ListFlowDefinitions -> Rep ListFlowDefinitions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFlowDefinitions x -> ListFlowDefinitions
$cfrom :: forall x. ListFlowDefinitions -> Rep ListFlowDefinitions x
Prelude.Generic)

-- |
-- Create a value of 'ListFlowDefinitions' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'creationTimeAfter', 'listFlowDefinitions_creationTimeAfter' - A filter that returns only flow definitions with a creation time greater
-- than or equal to the specified timestamp.
--
-- 'nextToken', 'listFlowDefinitions_nextToken' - A token to resume pagination.
--
-- 'sortOrder', 'listFlowDefinitions_sortOrder' - An optional value that specifies whether you want the results sorted in
-- @Ascending@ or @Descending@ order.
--
-- 'creationTimeBefore', 'listFlowDefinitions_creationTimeBefore' - A filter that returns only flow definitions that were created before the
-- specified timestamp.
--
-- 'maxResults', 'listFlowDefinitions_maxResults' - The total number of items to return. If the total number of available
-- items is more than the value specified in @MaxResults@, then a
-- @NextToken@ will be provided in the output that you can use to resume
-- pagination.
newListFlowDefinitions ::
  ListFlowDefinitions
newListFlowDefinitions :: ListFlowDefinitions
newListFlowDefinitions =
  ListFlowDefinitions' :: Maybe POSIX
-> Maybe Text
-> Maybe SortOrder
-> Maybe POSIX
-> Maybe Natural
-> ListFlowDefinitions
ListFlowDefinitions'
    { $sel:creationTimeAfter:ListFlowDefinitions' :: Maybe POSIX
creationTimeAfter =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFlowDefinitions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListFlowDefinitions' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListFlowDefinitions' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListFlowDefinitions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns only flow definitions with a creation time greater
-- than or equal to the specified timestamp.
listFlowDefinitions_creationTimeAfter :: Lens.Lens' ListFlowDefinitions (Prelude.Maybe Prelude.UTCTime)
listFlowDefinitions_creationTimeAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListFlowDefinitions -> f ListFlowDefinitions
listFlowDefinitions_creationTimeAfter = (ListFlowDefinitions -> Maybe POSIX)
-> (ListFlowDefinitions -> Maybe POSIX -> ListFlowDefinitions)
-> Lens
     ListFlowDefinitions ListFlowDefinitions (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowDefinitions' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListFlowDefinitions
s@ListFlowDefinitions' {} Maybe POSIX
a -> ListFlowDefinitions
s {$sel:creationTimeAfter:ListFlowDefinitions' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListFlowDefinitions) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListFlowDefinitions -> f ListFlowDefinitions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListFlowDefinitions
-> f ListFlowDefinitions
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

-- | A token to resume pagination.
listFlowDefinitions_nextToken :: Lens.Lens' ListFlowDefinitions (Prelude.Maybe Prelude.Text)
listFlowDefinitions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListFlowDefinitions -> f ListFlowDefinitions
listFlowDefinitions_nextToken = (ListFlowDefinitions -> Maybe Text)
-> (ListFlowDefinitions -> Maybe Text -> ListFlowDefinitions)
-> Lens
     ListFlowDefinitions ListFlowDefinitions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowDefinitions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFlowDefinitions
s@ListFlowDefinitions' {} Maybe Text
a -> ListFlowDefinitions
s {$sel:nextToken:ListFlowDefinitions' :: Maybe Text
nextToken = Maybe Text
a} :: ListFlowDefinitions)

-- | An optional value that specifies whether you want the results sorted in
-- @Ascending@ or @Descending@ order.
listFlowDefinitions_sortOrder :: Lens.Lens' ListFlowDefinitions (Prelude.Maybe SortOrder)
listFlowDefinitions_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListFlowDefinitions -> f ListFlowDefinitions
listFlowDefinitions_sortOrder = (ListFlowDefinitions -> Maybe SortOrder)
-> (ListFlowDefinitions -> Maybe SortOrder -> ListFlowDefinitions)
-> Lens
     ListFlowDefinitions
     ListFlowDefinitions
     (Maybe SortOrder)
     (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowDefinitions' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListFlowDefinitions
s@ListFlowDefinitions' {} Maybe SortOrder
a -> ListFlowDefinitions
s {$sel:sortOrder:ListFlowDefinitions' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListFlowDefinitions)

-- | A filter that returns only flow definitions that were created before the
-- specified timestamp.
listFlowDefinitions_creationTimeBefore :: Lens.Lens' ListFlowDefinitions (Prelude.Maybe Prelude.UTCTime)
listFlowDefinitions_creationTimeBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListFlowDefinitions -> f ListFlowDefinitions
listFlowDefinitions_creationTimeBefore = (ListFlowDefinitions -> Maybe POSIX)
-> (ListFlowDefinitions -> Maybe POSIX -> ListFlowDefinitions)
-> Lens
     ListFlowDefinitions ListFlowDefinitions (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowDefinitions' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListFlowDefinitions
s@ListFlowDefinitions' {} Maybe POSIX
a -> ListFlowDefinitions
s {$sel:creationTimeBefore:ListFlowDefinitions' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListFlowDefinitions) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListFlowDefinitions -> f ListFlowDefinitions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListFlowDefinitions
-> f ListFlowDefinitions
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 total number of items to return. If the total number of available
-- items is more than the value specified in @MaxResults@, then a
-- @NextToken@ will be provided in the output that you can use to resume
-- pagination.
listFlowDefinitions_maxResults :: Lens.Lens' ListFlowDefinitions (Prelude.Maybe Prelude.Natural)
listFlowDefinitions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListFlowDefinitions -> f ListFlowDefinitions
listFlowDefinitions_maxResults = (ListFlowDefinitions -> Maybe Natural)
-> (ListFlowDefinitions -> Maybe Natural -> ListFlowDefinitions)
-> Lens
     ListFlowDefinitions
     ListFlowDefinitions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowDefinitions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListFlowDefinitions
s@ListFlowDefinitions' {} Maybe Natural
a -> ListFlowDefinitions
s {$sel:maxResults:ListFlowDefinitions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListFlowDefinitions)

instance Core.AWSPager ListFlowDefinitions where
  page :: ListFlowDefinitions
-> AWSResponse ListFlowDefinitions -> Maybe ListFlowDefinitions
page ListFlowDefinitions
rq AWSResponse ListFlowDefinitions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFlowDefinitions
ListFlowDefinitionsResponse
rs
            ListFlowDefinitionsResponse
-> Getting (First Text) ListFlowDefinitionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFlowDefinitionsResponse
-> Const (First Text) ListFlowDefinitionsResponse
Lens' ListFlowDefinitionsResponse (Maybe Text)
listFlowDefinitionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFlowDefinitionsResponse
 -> Const (First Text) ListFlowDefinitionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFlowDefinitionsResponse 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 ListFlowDefinitions
forall a. Maybe a
Prelude.Nothing
    | [FlowDefinitionSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFlowDefinitions
ListFlowDefinitionsResponse
rs
            ListFlowDefinitionsResponse
-> Getting
     [FlowDefinitionSummary]
     ListFlowDefinitionsResponse
     [FlowDefinitionSummary]
-> [FlowDefinitionSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [FlowDefinitionSummary]
  ListFlowDefinitionsResponse
  [FlowDefinitionSummary]
Lens' ListFlowDefinitionsResponse [FlowDefinitionSummary]
listFlowDefinitionsResponse_flowDefinitionSummaries
        ) =
      Maybe ListFlowDefinitions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListFlowDefinitions -> Maybe ListFlowDefinitions
forall a. a -> Maybe a
Prelude.Just (ListFlowDefinitions -> Maybe ListFlowDefinitions)
-> ListFlowDefinitions -> Maybe ListFlowDefinitions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListFlowDefinitions
rq
          ListFlowDefinitions
-> (ListFlowDefinitions -> ListFlowDefinitions)
-> ListFlowDefinitions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListFlowDefinitions -> Identity ListFlowDefinitions
Lens
  ListFlowDefinitions ListFlowDefinitions (Maybe Text) (Maybe Text)
listFlowDefinitions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListFlowDefinitions -> Identity ListFlowDefinitions)
-> Maybe Text -> ListFlowDefinitions -> ListFlowDefinitions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListFlowDefinitions
ListFlowDefinitionsResponse
rs
          ListFlowDefinitionsResponse
-> Getting (First Text) ListFlowDefinitionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFlowDefinitionsResponse
-> Const (First Text) ListFlowDefinitionsResponse
Lens' ListFlowDefinitionsResponse (Maybe Text)
listFlowDefinitionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFlowDefinitionsResponse
 -> Const (First Text) ListFlowDefinitionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFlowDefinitionsResponse 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 ListFlowDefinitions where
  type
    AWSResponse ListFlowDefinitions =
      ListFlowDefinitionsResponse
  request :: ListFlowDefinitions -> Request ListFlowDefinitions
request = Service -> ListFlowDefinitions -> Request ListFlowDefinitions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListFlowDefinitions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListFlowDefinitions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListFlowDefinitions))
-> Logger
-> Service
-> Proxy ListFlowDefinitions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListFlowDefinitions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Int -> [FlowDefinitionSummary] -> ListFlowDefinitionsResponse
ListFlowDefinitionsResponse'
            (Maybe Text
 -> Int -> [FlowDefinitionSummary] -> ListFlowDefinitionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int -> [FlowDefinitionSummary] -> ListFlowDefinitionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Int -> [FlowDefinitionSummary] -> ListFlowDefinitionsResponse)
-> Either String Int
-> Either
     String ([FlowDefinitionSummary] -> ListFlowDefinitionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String ([FlowDefinitionSummary] -> ListFlowDefinitionsResponse)
-> Either String [FlowDefinitionSummary]
-> Either String ListFlowDefinitionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [FlowDefinitionSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FlowDefinitionSummaries"
                            Either String (Maybe [FlowDefinitionSummary])
-> [FlowDefinitionSummary] -> Either String [FlowDefinitionSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [FlowDefinitionSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListFlowDefinitions

instance Prelude.NFData ListFlowDefinitions

instance Core.ToHeaders ListFlowDefinitions where
  toHeaders :: ListFlowDefinitions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListFlowDefinitions -> 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.ListFlowDefinitions" ::
                          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 ListFlowDefinitions where
  toJSON :: ListFlowDefinitions -> Value
toJSON ListFlowDefinitions' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortOrder
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
creationTimeAfter :: Maybe POSIX
$sel:maxResults:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe Natural
$sel:creationTimeBefore:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe POSIX
$sel:sortOrder:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe SortOrder
$sel:nextToken:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe Text
$sel:creationTimeAfter:ListFlowDefinitions' :: ListFlowDefinitions -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CreationTimeAfter" 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
creationTimeAfter,
            (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
"CreationTimeBefore" 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
creationTimeBefore,
            (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
          ]
      )

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

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

-- | /See:/ 'newListFlowDefinitionsResponse' smart constructor.
data ListFlowDefinitionsResponse = ListFlowDefinitionsResponse'
  { -- | A token to resume pagination.
    ListFlowDefinitionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListFlowDefinitionsResponse -> Int
httpStatus :: Prelude.Int,
    -- | An array of objects describing the flow definitions.
    ListFlowDefinitionsResponse -> [FlowDefinitionSummary]
flowDefinitionSummaries :: [FlowDefinitionSummary]
  }
  deriving (ListFlowDefinitionsResponse -> ListFlowDefinitionsResponse -> Bool
(ListFlowDefinitionsResponse
 -> ListFlowDefinitionsResponse -> Bool)
-> (ListFlowDefinitionsResponse
    -> ListFlowDefinitionsResponse -> Bool)
-> Eq ListFlowDefinitionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFlowDefinitionsResponse -> ListFlowDefinitionsResponse -> Bool
$c/= :: ListFlowDefinitionsResponse -> ListFlowDefinitionsResponse -> Bool
== :: ListFlowDefinitionsResponse -> ListFlowDefinitionsResponse -> Bool
$c== :: ListFlowDefinitionsResponse -> ListFlowDefinitionsResponse -> Bool
Prelude.Eq, ReadPrec [ListFlowDefinitionsResponse]
ReadPrec ListFlowDefinitionsResponse
Int -> ReadS ListFlowDefinitionsResponse
ReadS [ListFlowDefinitionsResponse]
(Int -> ReadS ListFlowDefinitionsResponse)
-> ReadS [ListFlowDefinitionsResponse]
-> ReadPrec ListFlowDefinitionsResponse
-> ReadPrec [ListFlowDefinitionsResponse]
-> Read ListFlowDefinitionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFlowDefinitionsResponse]
$creadListPrec :: ReadPrec [ListFlowDefinitionsResponse]
readPrec :: ReadPrec ListFlowDefinitionsResponse
$creadPrec :: ReadPrec ListFlowDefinitionsResponse
readList :: ReadS [ListFlowDefinitionsResponse]
$creadList :: ReadS [ListFlowDefinitionsResponse]
readsPrec :: Int -> ReadS ListFlowDefinitionsResponse
$creadsPrec :: Int -> ReadS ListFlowDefinitionsResponse
Prelude.Read, Int -> ListFlowDefinitionsResponse -> ShowS
[ListFlowDefinitionsResponse] -> ShowS
ListFlowDefinitionsResponse -> String
(Int -> ListFlowDefinitionsResponse -> ShowS)
-> (ListFlowDefinitionsResponse -> String)
-> ([ListFlowDefinitionsResponse] -> ShowS)
-> Show ListFlowDefinitionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFlowDefinitionsResponse] -> ShowS
$cshowList :: [ListFlowDefinitionsResponse] -> ShowS
show :: ListFlowDefinitionsResponse -> String
$cshow :: ListFlowDefinitionsResponse -> String
showsPrec :: Int -> ListFlowDefinitionsResponse -> ShowS
$cshowsPrec :: Int -> ListFlowDefinitionsResponse -> ShowS
Prelude.Show, (forall x.
 ListFlowDefinitionsResponse -> Rep ListFlowDefinitionsResponse x)
-> (forall x.
    Rep ListFlowDefinitionsResponse x -> ListFlowDefinitionsResponse)
-> Generic ListFlowDefinitionsResponse
forall x.
Rep ListFlowDefinitionsResponse x -> ListFlowDefinitionsResponse
forall x.
ListFlowDefinitionsResponse -> Rep ListFlowDefinitionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListFlowDefinitionsResponse x -> ListFlowDefinitionsResponse
$cfrom :: forall x.
ListFlowDefinitionsResponse -> Rep ListFlowDefinitionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListFlowDefinitionsResponse' 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', 'listFlowDefinitionsResponse_nextToken' - A token to resume pagination.
--
-- 'httpStatus', 'listFlowDefinitionsResponse_httpStatus' - The response's http status code.
--
-- 'flowDefinitionSummaries', 'listFlowDefinitionsResponse_flowDefinitionSummaries' - An array of objects describing the flow definitions.
newListFlowDefinitionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListFlowDefinitionsResponse
newListFlowDefinitionsResponse :: Int -> ListFlowDefinitionsResponse
newListFlowDefinitionsResponse Int
pHttpStatus_ =
  ListFlowDefinitionsResponse' :: Maybe Text
-> Int -> [FlowDefinitionSummary] -> ListFlowDefinitionsResponse
ListFlowDefinitionsResponse'
    { $sel:nextToken:ListFlowDefinitionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListFlowDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:flowDefinitionSummaries:ListFlowDefinitionsResponse' :: [FlowDefinitionSummary]
flowDefinitionSummaries = [FlowDefinitionSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token to resume pagination.
listFlowDefinitionsResponse_nextToken :: Lens.Lens' ListFlowDefinitionsResponse (Prelude.Maybe Prelude.Text)
listFlowDefinitionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListFlowDefinitionsResponse -> f ListFlowDefinitionsResponse
listFlowDefinitionsResponse_nextToken = (ListFlowDefinitionsResponse -> Maybe Text)
-> (ListFlowDefinitionsResponse
    -> Maybe Text -> ListFlowDefinitionsResponse)
-> Lens' ListFlowDefinitionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowDefinitionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFlowDefinitionsResponse' :: ListFlowDefinitionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFlowDefinitionsResponse
s@ListFlowDefinitionsResponse' {} Maybe Text
a -> ListFlowDefinitionsResponse
s {$sel:nextToken:ListFlowDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFlowDefinitionsResponse)

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

-- | An array of objects describing the flow definitions.
listFlowDefinitionsResponse_flowDefinitionSummaries :: Lens.Lens' ListFlowDefinitionsResponse [FlowDefinitionSummary]
listFlowDefinitionsResponse_flowDefinitionSummaries :: ([FlowDefinitionSummary] -> f [FlowDefinitionSummary])
-> ListFlowDefinitionsResponse -> f ListFlowDefinitionsResponse
listFlowDefinitionsResponse_flowDefinitionSummaries = (ListFlowDefinitionsResponse -> [FlowDefinitionSummary])
-> (ListFlowDefinitionsResponse
    -> [FlowDefinitionSummary] -> ListFlowDefinitionsResponse)
-> Lens' ListFlowDefinitionsResponse [FlowDefinitionSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowDefinitionsResponse' {[FlowDefinitionSummary]
flowDefinitionSummaries :: [FlowDefinitionSummary]
$sel:flowDefinitionSummaries:ListFlowDefinitionsResponse' :: ListFlowDefinitionsResponse -> [FlowDefinitionSummary]
flowDefinitionSummaries} -> [FlowDefinitionSummary]
flowDefinitionSummaries) (\s :: ListFlowDefinitionsResponse
s@ListFlowDefinitionsResponse' {} [FlowDefinitionSummary]
a -> ListFlowDefinitionsResponse
s {$sel:flowDefinitionSummaries:ListFlowDefinitionsResponse' :: [FlowDefinitionSummary]
flowDefinitionSummaries = [FlowDefinitionSummary]
a} :: ListFlowDefinitionsResponse) (([FlowDefinitionSummary] -> f [FlowDefinitionSummary])
 -> ListFlowDefinitionsResponse -> f ListFlowDefinitionsResponse)
-> (([FlowDefinitionSummary] -> f [FlowDefinitionSummary])
    -> [FlowDefinitionSummary] -> f [FlowDefinitionSummary])
-> ([FlowDefinitionSummary] -> f [FlowDefinitionSummary])
-> ListFlowDefinitionsResponse
-> f ListFlowDefinitionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([FlowDefinitionSummary] -> f [FlowDefinitionSummary])
-> [FlowDefinitionSummary] -> f [FlowDefinitionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListFlowDefinitionsResponse