{-# 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.CodeBuild.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 build project names, with each build project name
-- representing a single build project.
--
-- This operation returns paginated results.
module Amazonka.CodeBuild.ListProjects
  ( -- * Creating a Request
    ListProjects (..),
    newListProjects,

    -- * Request Lenses
    listProjects_sortOrder,
    listProjects_nextToken,
    listProjects_sortBy,

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

    -- * Response Lenses
    listProjectsResponse_nextToken,
    listProjectsResponse_projects,
    listProjectsResponse_httpStatus,
  )
where

import Amazonka.CodeBuild.Types
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

-- | /See:/ 'newListProjects' smart constructor.
data ListProjects = ListProjects'
  { -- | The order in which to list build projects. Valid values include:
    --
    -- -   @ASCENDING@: List in ascending order.
    --
    -- -   @DESCENDING@: List in descending order.
    --
    -- Use @sortBy@ to specify the criterion to be used to list build project
    -- names.
    ListProjects -> Maybe SortOrderType
sortOrder :: Prelude.Maybe SortOrderType,
    -- | During a previous call, if there are more than 100 items in the list,
    -- only the first 100 items are returned, along with a unique string called
    -- a /nextToken/. To get the next batch of items in the list, call this
    -- operation again, adding the next token to the call. To get all of the
    -- items in the list, keep calling this operation with each subsequent next
    -- token that is returned, until no more next tokens are returned.
    ListProjects -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The criterion to be used to list build project names. Valid values
    -- include:
    --
    -- -   @CREATED_TIME@: List based on when each build project was created.
    --
    -- -   @LAST_MODIFIED_TIME@: List based on when information about each
    --     build project was last changed.
    --
    -- -   @NAME@: List based on each build project\'s name.
    --
    -- Use @sortOrder@ to specify in what order to list the build project names
    -- based on the preceding criteria.
    ListProjects -> Maybe ProjectSortByType
sortBy :: Prelude.Maybe ProjectSortByType
  }
  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:
--
-- 'sortOrder', 'listProjects_sortOrder' - The order in which to list build projects. Valid values include:
--
-- -   @ASCENDING@: List in ascending order.
--
-- -   @DESCENDING@: List in descending order.
--
-- Use @sortBy@ to specify the criterion to be used to list build project
-- names.
--
-- 'nextToken', 'listProjects_nextToken' - During a previous call, if there are more than 100 items in the list,
-- only the first 100 items are returned, along with a unique string called
-- a /nextToken/. To get the next batch of items in the list, call this
-- operation again, adding the next token to the call. To get all of the
-- items in the list, keep calling this operation with each subsequent next
-- token that is returned, until no more next tokens are returned.
--
-- 'sortBy', 'listProjects_sortBy' - The criterion to be used to list build project names. Valid values
-- include:
--
-- -   @CREATED_TIME@: List based on when each build project was created.
--
-- -   @LAST_MODIFIED_TIME@: List based on when information about each
--     build project was last changed.
--
-- -   @NAME@: List based on each build project\'s name.
--
-- Use @sortOrder@ to specify in what order to list the build project names
-- based on the preceding criteria.
newListProjects ::
  ListProjects
newListProjects :: ListProjects
newListProjects =
  ListProjects' :: Maybe SortOrderType
-> Maybe Text -> Maybe ProjectSortByType -> ListProjects
ListProjects'
    { $sel:sortOrder:ListProjects' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListProjects' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListProjects' :: Maybe ProjectSortByType
sortBy = Maybe ProjectSortByType
forall a. Maybe a
Prelude.Nothing
    }

-- | The order in which to list build projects. Valid values include:
--
-- -   @ASCENDING@: List in ascending order.
--
-- -   @DESCENDING@: List in descending order.
--
-- Use @sortBy@ to specify the criterion to be used to list build project
-- names.
listProjects_sortOrder :: Lens.Lens' ListProjects (Prelude.Maybe SortOrderType)
listProjects_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> ListProjects -> f ListProjects
listProjects_sortOrder = (ListProjects -> Maybe SortOrderType)
-> (ListProjects -> Maybe SortOrderType -> ListProjects)
-> Lens
     ListProjects
     ListProjects
     (Maybe SortOrderType)
     (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjects' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:ListProjects' :: ListProjects -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: ListProjects
s@ListProjects' {} Maybe SortOrderType
a -> ListProjects
s {$sel:sortOrder:ListProjects' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: ListProjects)

-- | During a previous call, if there are more than 100 items in the list,
-- only the first 100 items are returned, along with a unique string called
-- a /nextToken/. To get the next batch of items in the list, call this
-- operation again, adding the next token to the call. To get all of the
-- items in the list, keep calling this operation with each subsequent next
-- token that is returned, until no more next tokens are returned.
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 criterion to be used to list build project names. Valid values
-- include:
--
-- -   @CREATED_TIME@: List based on when each build project was created.
--
-- -   @LAST_MODIFIED_TIME@: List based on when information about each
--     build project was last changed.
--
-- -   @NAME@: List based on each build project\'s name.
--
-- Use @sortOrder@ to specify in what order to list the build project names
-- based on the preceding criteria.
listProjects_sortBy :: Lens.Lens' ListProjects (Prelude.Maybe ProjectSortByType)
listProjects_sortBy :: (Maybe ProjectSortByType -> f (Maybe ProjectSortByType))
-> ListProjects -> f ListProjects
listProjects_sortBy = (ListProjects -> Maybe ProjectSortByType)
-> (ListProjects -> Maybe ProjectSortByType -> ListProjects)
-> Lens
     ListProjects
     ListProjects
     (Maybe ProjectSortByType)
     (Maybe ProjectSortByType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjects' {Maybe ProjectSortByType
sortBy :: Maybe ProjectSortByType
$sel:sortBy:ListProjects' :: ListProjects -> Maybe ProjectSortByType
sortBy} -> Maybe ProjectSortByType
sortBy) (\s :: ListProjects
s@ListProjects' {} Maybe ProjectSortByType
a -> ListProjects
s {$sel:sortBy:ListProjects' :: Maybe ProjectSortByType
sortBy = Maybe ProjectSortByType
a} :: ListProjects)

instance Core.AWSPager ListProjects where
  page :: ListProjects -> AWSResponse ListProjects -> Maybe ListProjects
page ListProjects
rq AWSResponse ListProjects
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListProjects
ListProjectsResponse
rs
            ListProjectsResponse
-> Getting (First Text) ListProjectsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListProjectsResponse -> Const (First Text) ListProjectsResponse
Lens' ListProjectsResponse (Maybe Text)
listProjectsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListProjectsResponse -> Const (First Text) ListProjectsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListProjectsResponse 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 ListProjects
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListProjects
ListProjectsResponse
rs
            ListProjectsResponse
-> Getting (First [Text]) ListProjectsResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> ListProjectsResponse
-> Const (First [Text]) ListProjectsResponse
Lens' ListProjectsResponse (Maybe (NonEmpty Text))
listProjectsResponse_projects ((Maybe (NonEmpty Text)
  -> Const (First [Text]) (Maybe (NonEmpty Text)))
 -> ListProjectsResponse
 -> Const (First [Text]) ListProjectsResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe (NonEmpty Text)
    -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> Getting (First [Text]) ListProjectsResponse [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
-> Maybe (NonEmpty Text)
-> Const (First [Text]) (Maybe (NonEmpty Text))
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
              ((NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
 -> Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> (([Text] -> Const (First [Text]) [Text])
    -> NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
-> ([Text] -> Const (First [Text]) [Text])
-> Maybe (NonEmpty Text)
-> Const (First [Text]) (Maybe (NonEmpty Text))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> [Text])
-> ([Text] -> Const (First [Text]) [Text])
-> NonEmpty Text
-> Const (First [Text]) (NonEmpty Text)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to NonEmpty Text -> [Text]
forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
      Maybe ListProjects
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListProjects -> Maybe ListProjects
forall a. a -> Maybe a
Prelude.Just (ListProjects -> Maybe ListProjects)
-> ListProjects -> Maybe ListProjects
forall a b. (a -> b) -> a -> b
Prelude.$
        ListProjects
rq
          ListProjects -> (ListProjects -> ListProjects) -> ListProjects
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListProjects -> Identity ListProjects
Lens ListProjects ListProjects (Maybe Text) (Maybe Text)
listProjects_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListProjects -> Identity ListProjects)
-> Maybe Text -> ListProjects -> ListProjects
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListProjects
ListProjectsResponse
rs
          ListProjectsResponse
-> Getting (First Text) ListProjectsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListProjectsResponse -> Const (First Text) ListProjectsResponse
Lens' ListProjectsResponse (Maybe Text)
listProjectsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListProjectsResponse -> Const (First Text) ListProjectsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListProjectsResponse 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 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 -> Maybe (NonEmpty Text) -> Int -> ListProjectsResponse
ListProjectsResponse'
            (Maybe Text
 -> Maybe (NonEmpty Text) -> Int -> ListProjectsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe (NonEmpty Text) -> Int -> 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 (Maybe (NonEmpty Text) -> Int -> ListProjectsResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either String (Int -> ListProjectsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"projects")
            Either String (Int -> ListProjectsResponse)
-> Either String Int -> Either String 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))
      )

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
"CodeBuild_20161006.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 Text
Maybe ProjectSortByType
Maybe SortOrderType
sortBy :: Maybe ProjectSortByType
nextToken :: Maybe Text
sortOrder :: Maybe SortOrderType
$sel:sortBy:ListProjects' :: ListProjects -> Maybe ProjectSortByType
$sel:nextToken:ListProjects' :: ListProjects -> Maybe Text
$sel:sortOrder:ListProjects' :: ListProjects -> Maybe SortOrderType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"sortOrder" Text -> SortOrderType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortOrderType -> Pair) -> Maybe SortOrderType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrderType
sortOrder,
            (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
"sortBy" Text -> ProjectSortByType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ProjectSortByType -> Pair)
-> Maybe ProjectSortByType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProjectSortByType
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 there are more than 100 items in the list, only the first 100 items
    -- are returned, along with a unique string called a /nextToken/. To get
    -- the next batch of items in the list, call this operation again, adding
    -- the next token to the call.
    ListProjectsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of build project names, with each build project name
    -- representing a single build project.
    ListProjectsResponse -> Maybe (NonEmpty Text)
projects :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The response's http status code.
    ListProjectsResponse -> Int
httpStatus :: Prelude.Int
  }
  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 there are more than 100 items in the list, only the first 100 items
-- are returned, along with a unique string called a /nextToken/. To get
-- the next batch of items in the list, call this operation again, adding
-- the next token to the call.
--
-- 'projects', 'listProjectsResponse_projects' - The list of build project names, with each build project name
-- representing a single build project.
--
-- 'httpStatus', 'listProjectsResponse_httpStatus' - The response's http status code.
newListProjectsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProjectsResponse
newListProjectsResponse :: Int -> ListProjectsResponse
newListProjectsResponse Int
pHttpStatus_ =
  ListProjectsResponse' :: Maybe Text -> Maybe (NonEmpty Text) -> Int -> ListProjectsResponse
ListProjectsResponse'
    { $sel:nextToken:ListProjectsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:projects:ListProjectsResponse' :: Maybe (NonEmpty Text)
projects = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListProjectsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If there are more than 100 items in the list, only the first 100 items
-- are returned, along with a unique string called a /nextToken/. To get
-- the next batch of items in the list, call this operation again, adding
-- the next token to the call.
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 (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 list of build project names, with each build project name
-- representing a single build project.
listProjectsResponse_projects :: Lens.Lens' ListProjectsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listProjectsResponse_projects :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListProjectsResponse -> f ListProjectsResponse
listProjectsResponse_projects = (ListProjectsResponse -> Maybe (NonEmpty Text))
-> (ListProjectsResponse
    -> Maybe (NonEmpty Text) -> ListProjectsResponse)
-> Lens' ListProjectsResponse (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProjectsResponse' {Maybe (NonEmpty Text)
projects :: Maybe (NonEmpty Text)
$sel:projects:ListProjectsResponse' :: ListProjectsResponse -> Maybe (NonEmpty Text)
projects} -> Maybe (NonEmpty Text)
projects) (\s :: ListProjectsResponse
s@ListProjectsResponse' {} Maybe (NonEmpty Text)
a -> ListProjectsResponse
s {$sel:projects:ListProjectsResponse' :: Maybe (NonEmpty Text)
projects = Maybe (NonEmpty Text)
a} :: ListProjectsResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListProjectsResponse -> f ListProjectsResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListProjectsResponse
-> f ListProjectsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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)

instance Prelude.NFData ListProjectsResponse