{-# 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.ListProjects
-- 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 the projects in an Amazon Web Services account.
module Amazonka.SageMaker.ListProjects
  ( -- * Creating a Request
    ListProjects (..),
    newListProjects,

    -- * Request Lenses
    listProjects_nameContains,
    listProjects_creationTimeAfter,
    listProjects_nextToken,
    listProjects_sortOrder,
    listProjects_creationTimeBefore,
    listProjects_maxResults,
    listProjects_sortBy,

    -- * Destructuring the Response
    ListProjectsResponse (..),
    newListProjectsResponse,

    -- * Response Lenses
    listProjectsResponse_nextToken,
    listProjectsResponse_httpStatus,
    listProjectsResponse_projectSummaryList,
  )
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:/ 'newListProjects' smart constructor.
data ListProjects = ListProjects'
  { -- | A filter that returns the projects whose name contains a specified
    -- string.
    ListProjects -> Maybe Text
nameContains :: Prelude.Maybe Prelude.Text,
    -- | A filter that returns the projects that were created after a specified
    -- time.
    ListProjects -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Core.POSIX,
    -- | If the result of the previous @ListProjects@ request was truncated, the
    -- response includes a @NextToken@. To retrieve the next set of projects,
    -- use the token in the next request.
    ListProjects -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order for results. The default is @Ascending@.
    ListProjects -> Maybe ProjectSortOrder
sortOrder :: Prelude.Maybe ProjectSortOrder,
    -- | A filter that returns the projects that were created before a specified
    -- time.
    ListProjects -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of projects to return in the response.
    ListProjects -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The field by which to sort results. The default is @CreationTime@.
    ListProjects -> Maybe ProjectSortBy
sortBy :: Prelude.Maybe ProjectSortBy
  }
  deriving (ListProjects -> ListProjects -> Bool
(ListProjects -> ListProjects -> Bool)
-> (ListProjects -> ListProjects -> Bool) -> Eq ListProjects
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProjects -> ListProjects -> Bool
$c/= :: ListProjects -> ListProjects -> Bool
== :: ListProjects -> ListProjects -> Bool
$c== :: ListProjects -> ListProjects -> Bool
Prelude.Eq, ReadPrec [ListProjects]
ReadPrec ListProjects
Int -> ReadS ListProjects
ReadS [ListProjects]
(Int -> ReadS ListProjects)
-> ReadS [ListProjects]
-> ReadPrec ListProjects
-> ReadPrec [ListProjects]
-> Read ListProjects
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProjects]
$creadListPrec :: ReadPrec [ListProjects]
readPrec :: ReadPrec ListProjects
$creadPrec :: ReadPrec ListProjects
readList :: ReadS [ListProjects]
$creadList :: ReadS [ListProjects]
readsPrec :: Int -> ReadS ListProjects
$creadsPrec :: Int -> ReadS ListProjects
Prelude.Read, Int -> ListProjects -> ShowS
[ListProjects] -> ShowS
ListProjects -> String
(Int -> ListProjects -> ShowS)
-> (ListProjects -> String)
-> ([ListProjects] -> ShowS)
-> Show ListProjects
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProjects] -> ShowS
$cshowList :: [ListProjects] -> ShowS
show :: ListProjects -> String
$cshow :: ListProjects -> String
showsPrec :: Int -> ListProjects -> ShowS
$cshowsPrec :: Int -> ListProjects -> ShowS
Prelude.Show, (forall x. ListProjects -> Rep ListProjects x)
-> (forall x. Rep ListProjects x -> ListProjects)
-> Generic ListProjects
forall x. Rep ListProjects x -> ListProjects
forall x. ListProjects -> Rep ListProjects x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProjects x -> ListProjects
$cfrom :: forall x. ListProjects -> Rep ListProjects x
Prelude.Generic)

-- |
-- Create a value of 'ListProjects' 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:
--
-- 'nameContains', 'listProjects_nameContains' - A filter that returns the projects whose name contains a specified
-- string.
--
-- 'creationTimeAfter', 'listProjects_creationTimeAfter' - A filter that returns the projects that were created after a specified
-- time.
--
-- 'nextToken', 'listProjects_nextToken' - If the result of the previous @ListProjects@ request was truncated, the
-- response includes a @NextToken@. To retrieve the next set of projects,
-- use the token in the next request.
--
-- 'sortOrder', 'listProjects_sortOrder' - The sort order for results. The default is @Ascending@.
--
-- 'creationTimeBefore', 'listProjects_creationTimeBefore' - A filter that returns the projects that were created before a specified
-- time.
--
-- 'maxResults', 'listProjects_maxResults' - The maximum number of projects to return in the response.
--
-- 'sortBy', 'listProjects_sortBy' - The field by which to sort results. The default is @CreationTime@.
newListProjects ::
  ListProjects
newListProjects :: ListProjects
newListProjects =
  ListProjects' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe ProjectSortOrder
-> Maybe POSIX
-> Maybe Natural
-> Maybe ProjectSortBy
-> ListProjects
ListProjects'
    { $sel:nameContains:ListProjects' :: Maybe Text
nameContains = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeAfter:ListProjects' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListProjects' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListProjects' :: Maybe ProjectSortOrder
sortOrder = Maybe ProjectSortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListProjects' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListProjects' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListProjects' :: Maybe ProjectSortBy
sortBy = Maybe ProjectSortBy
forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns the projects whose name contains a specified
-- string.
listProjects_nameContains :: Lens.Lens' ListProjects (Prelude.Maybe Prelude.Text)
listProjects_nameContains :: (Maybe Text -> f (Maybe Text)) -> ListProjects -> f ListProjects
listProjects_nameContains = (ListProjects -> Maybe Text)
-> (ListProjects -> Maybe Text -> ListProjects)
-> Lens ListProjects ListProjects (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjects' {Maybe Text
nameContains :: Maybe Text
$sel:nameContains:ListProjects' :: ListProjects -> Maybe Text
nameContains} -> Maybe Text
nameContains) (\s :: ListProjects
s@ListProjects' {} Maybe Text
a -> ListProjects
s {$sel:nameContains:ListProjects' :: Maybe Text
nameContains = Maybe Text
a} :: ListProjects)

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

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

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

-- | A filter that returns the projects that were created before a specified
-- time.
listProjects_creationTimeBefore :: Lens.Lens' ListProjects (Prelude.Maybe Prelude.UTCTime)
listProjects_creationTimeBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListProjects -> f ListProjects
listProjects_creationTimeBefore = (ListProjects -> Maybe POSIX)
-> (ListProjects -> Maybe POSIX -> ListProjects)
-> Lens ListProjects ListProjects (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjects' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListProjects' :: ListProjects -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListProjects
s@ListProjects' {} Maybe POSIX
a -> ListProjects
s {$sel:creationTimeBefore:ListProjects' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListProjects) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListProjects -> f ListProjects)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListProjects
-> f ListProjects
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 maximum number of projects to return in the response.
listProjects_maxResults :: Lens.Lens' ListProjects (Prelude.Maybe Prelude.Natural)
listProjects_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListProjects -> f ListProjects
listProjects_maxResults = (ListProjects -> Maybe Natural)
-> (ListProjects -> Maybe Natural -> ListProjects)
-> Lens ListProjects ListProjects (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjects' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProjects' :: ListProjects -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProjects
s@ListProjects' {} Maybe Natural
a -> ListProjects
s {$sel:maxResults:ListProjects' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProjects)

-- | The field by which to sort results. The default is @CreationTime@.
listProjects_sortBy :: Lens.Lens' ListProjects (Prelude.Maybe ProjectSortBy)
listProjects_sortBy :: (Maybe ProjectSortBy -> f (Maybe ProjectSortBy))
-> ListProjects -> f ListProjects
listProjects_sortBy = (ListProjects -> Maybe ProjectSortBy)
-> (ListProjects -> Maybe ProjectSortBy -> ListProjects)
-> Lens
     ListProjects
     ListProjects
     (Maybe ProjectSortBy)
     (Maybe ProjectSortBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjects' {Maybe ProjectSortBy
sortBy :: Maybe ProjectSortBy
$sel:sortBy:ListProjects' :: ListProjects -> Maybe ProjectSortBy
sortBy} -> Maybe ProjectSortBy
sortBy) (\s :: ListProjects
s@ListProjects' {} Maybe ProjectSortBy
a -> ListProjects
s {$sel:sortBy:ListProjects' :: Maybe ProjectSortBy
sortBy = Maybe ProjectSortBy
a} :: ListProjects)

instance Core.AWSRequest ListProjects where
  type AWSResponse ListProjects = ListProjectsResponse
  request :: ListProjects -> Request ListProjects
request = Service -> ListProjects -> Request ListProjects
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListProjects
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProjects)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListProjects))
-> Logger
-> Service
-> Proxy ListProjects
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProjects)))
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 -> [ProjectSummary] -> ListProjectsResponse
ListProjectsResponse'
            (Maybe Text -> Int -> [ProjectSummary] -> ListProjectsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [ProjectSummary] -> ListProjectsResponse)
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 -> [ProjectSummary] -> ListProjectsResponse)
-> Either String Int
-> Either String ([ProjectSummary] -> ListProjectsResponse)
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 ([ProjectSummary] -> ListProjectsResponse)
-> Either String [ProjectSummary]
-> Either String ListProjectsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [ProjectSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProjectSummaryList"
                            Either String (Maybe [ProjectSummary])
-> [ProjectSummary] -> Either String [ProjectSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ProjectSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListProjects

instance Prelude.NFData ListProjects

instance Core.ToHeaders ListProjects where
  toHeaders :: ListProjects -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListProjects -> 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.ListProjects" :: 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 ListProjects where
  toJSON :: ListProjects -> Value
toJSON ListProjects' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe ProjectSortBy
Maybe ProjectSortOrder
sortBy :: Maybe ProjectSortBy
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
sortOrder :: Maybe ProjectSortOrder
nextToken :: Maybe Text
creationTimeAfter :: Maybe POSIX
nameContains :: Maybe Text
$sel:sortBy:ListProjects' :: ListProjects -> Maybe ProjectSortBy
$sel:maxResults:ListProjects' :: ListProjects -> Maybe Natural
$sel:creationTimeBefore:ListProjects' :: ListProjects -> Maybe POSIX
$sel:sortOrder:ListProjects' :: ListProjects -> Maybe ProjectSortOrder
$sel:nextToken:ListProjects' :: ListProjects -> Maybe Text
$sel:creationTimeAfter:ListProjects' :: ListProjects -> Maybe POSIX
$sel:nameContains:ListProjects' :: ListProjects -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NameContains" 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
nameContains,
            (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 -> ProjectSortOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ProjectSortOrder -> Pair) -> Maybe ProjectSortOrder -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProjectSortOrder
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,
            (Text
"SortBy" Text -> ProjectSortBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ProjectSortBy -> Pair) -> Maybe ProjectSortBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProjectSortBy
sortBy
          ]
      )

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

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

-- | /See:/ 'newListProjectsResponse' smart constructor.
data ListProjectsResponse = ListProjectsResponse'
  { -- | If the result of the previous @ListCompilationJobs@ request was
    -- truncated, the response includes a @NextToken@. To retrieve the next set
    -- of model compilation jobs, use the token in the next request.
    ListProjectsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListProjectsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of summaries of projects.
    ListProjectsResponse -> [ProjectSummary]
projectSummaryList :: [ProjectSummary]
  }
  deriving (ListProjectsResponse -> ListProjectsResponse -> Bool
(ListProjectsResponse -> ListProjectsResponse -> Bool)
-> (ListProjectsResponse -> ListProjectsResponse -> Bool)
-> Eq ListProjectsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProjectsResponse -> ListProjectsResponse -> Bool
$c/= :: ListProjectsResponse -> ListProjectsResponse -> Bool
== :: ListProjectsResponse -> ListProjectsResponse -> Bool
$c== :: ListProjectsResponse -> ListProjectsResponse -> Bool
Prelude.Eq, ReadPrec [ListProjectsResponse]
ReadPrec ListProjectsResponse
Int -> ReadS ListProjectsResponse
ReadS [ListProjectsResponse]
(Int -> ReadS ListProjectsResponse)
-> ReadS [ListProjectsResponse]
-> ReadPrec ListProjectsResponse
-> ReadPrec [ListProjectsResponse]
-> Read ListProjectsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProjectsResponse]
$creadListPrec :: ReadPrec [ListProjectsResponse]
readPrec :: ReadPrec ListProjectsResponse
$creadPrec :: ReadPrec ListProjectsResponse
readList :: ReadS [ListProjectsResponse]
$creadList :: ReadS [ListProjectsResponse]
readsPrec :: Int -> ReadS ListProjectsResponse
$creadsPrec :: Int -> ReadS ListProjectsResponse
Prelude.Read, Int -> ListProjectsResponse -> ShowS
[ListProjectsResponse] -> ShowS
ListProjectsResponse -> String
(Int -> ListProjectsResponse -> ShowS)
-> (ListProjectsResponse -> String)
-> ([ListProjectsResponse] -> ShowS)
-> Show ListProjectsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProjectsResponse] -> ShowS
$cshowList :: [ListProjectsResponse] -> ShowS
show :: ListProjectsResponse -> String
$cshow :: ListProjectsResponse -> String
showsPrec :: Int -> ListProjectsResponse -> ShowS
$cshowsPrec :: Int -> ListProjectsResponse -> ShowS
Prelude.Show, (forall x. ListProjectsResponse -> Rep ListProjectsResponse x)
-> (forall x. Rep ListProjectsResponse x -> ListProjectsResponse)
-> Generic ListProjectsResponse
forall x. Rep ListProjectsResponse x -> ListProjectsResponse
forall x. ListProjectsResponse -> Rep ListProjectsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProjectsResponse x -> ListProjectsResponse
$cfrom :: forall x. ListProjectsResponse -> Rep ListProjectsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListProjectsResponse' 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', 'listProjectsResponse_nextToken' - If the result of the previous @ListCompilationJobs@ request was
-- truncated, the response includes a @NextToken@. To retrieve the next set
-- of model compilation jobs, use the token in the next request.
--
-- 'httpStatus', 'listProjectsResponse_httpStatus' - The response's http status code.
--
-- 'projectSummaryList', 'listProjectsResponse_projectSummaryList' - A list of summaries of projects.
newListProjectsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProjectsResponse
newListProjectsResponse :: Int -> ListProjectsResponse
newListProjectsResponse Int
pHttpStatus_ =
  ListProjectsResponse' :: Maybe Text -> Int -> [ProjectSummary] -> ListProjectsResponse
ListProjectsResponse'
    { $sel:nextToken:ListProjectsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListProjectsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:projectSummaryList:ListProjectsResponse' :: [ProjectSummary]
projectSummaryList = [ProjectSummary]
forall a. Monoid a => a
Prelude.mempty
    }

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

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

-- | A list of summaries of projects.
listProjectsResponse_projectSummaryList :: Lens.Lens' ListProjectsResponse [ProjectSummary]
listProjectsResponse_projectSummaryList :: ([ProjectSummary] -> f [ProjectSummary])
-> ListProjectsResponse -> f ListProjectsResponse
listProjectsResponse_projectSummaryList = (ListProjectsResponse -> [ProjectSummary])
-> (ListProjectsResponse
    -> [ProjectSummary] -> ListProjectsResponse)
-> Lens
     ListProjectsResponse
     ListProjectsResponse
     [ProjectSummary]
     [ProjectSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjectsResponse' {[ProjectSummary]
projectSummaryList :: [ProjectSummary]
$sel:projectSummaryList:ListProjectsResponse' :: ListProjectsResponse -> [ProjectSummary]
projectSummaryList} -> [ProjectSummary]
projectSummaryList) (\s :: ListProjectsResponse
s@ListProjectsResponse' {} [ProjectSummary]
a -> ListProjectsResponse
s {$sel:projectSummaryList:ListProjectsResponse' :: [ProjectSummary]
projectSummaryList = [ProjectSummary]
a} :: ListProjectsResponse) (([ProjectSummary] -> f [ProjectSummary])
 -> ListProjectsResponse -> f ListProjectsResponse)
-> (([ProjectSummary] -> f [ProjectSummary])
    -> [ProjectSummary] -> f [ProjectSummary])
-> ([ProjectSummary] -> f [ProjectSummary])
-> ListProjectsResponse
-> f ListProjectsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ProjectSummary] -> f [ProjectSummary])
-> [ProjectSummary] -> f [ProjectSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListProjectsResponse