{-# 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.ListBuildsForProject
-- 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 identifiers for the specified build project, with
-- each build identifier representing a single build.
--
-- This operation returns paginated results.
module Amazonka.CodeBuild.ListBuildsForProject
  ( -- * Creating a Request
    ListBuildsForProject (..),
    newListBuildsForProject,

    -- * Request Lenses
    listBuildsForProject_sortOrder,
    listBuildsForProject_nextToken,
    listBuildsForProject_projectName,

    -- * Destructuring the Response
    ListBuildsForProjectResponse (..),
    newListBuildsForProjectResponse,

    -- * Response Lenses
    listBuildsForProjectResponse_ids,
    listBuildsForProjectResponse_nextToken,
    listBuildsForProjectResponse_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:/ 'newListBuildsForProject' smart constructor.
data ListBuildsForProject = ListBuildsForProject'
  { -- | The order to sort the results in. The results are sorted by build
    -- number, not the build identifier. If this is not specified, the results
    -- are sorted in descending order.
    --
    -- Valid values include:
    --
    -- -   @ASCENDING@: List the build identifiers in ascending order, by build
    --     number.
    --
    -- -   @DESCENDING@: List the build identifiers in descending order, by
    --     build number.
    --
    -- If the project has more than 100 builds, setting the sort order will
    -- result in an error.
    ListBuildsForProject -> 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.
    ListBuildsForProject -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the CodeBuild project.
    ListBuildsForProject -> Text
projectName :: Prelude.Text
  }
  deriving (ListBuildsForProject -> ListBuildsForProject -> Bool
(ListBuildsForProject -> ListBuildsForProject -> Bool)
-> (ListBuildsForProject -> ListBuildsForProject -> Bool)
-> Eq ListBuildsForProject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBuildsForProject -> ListBuildsForProject -> Bool
$c/= :: ListBuildsForProject -> ListBuildsForProject -> Bool
== :: ListBuildsForProject -> ListBuildsForProject -> Bool
$c== :: ListBuildsForProject -> ListBuildsForProject -> Bool
Prelude.Eq, ReadPrec [ListBuildsForProject]
ReadPrec ListBuildsForProject
Int -> ReadS ListBuildsForProject
ReadS [ListBuildsForProject]
(Int -> ReadS ListBuildsForProject)
-> ReadS [ListBuildsForProject]
-> ReadPrec ListBuildsForProject
-> ReadPrec [ListBuildsForProject]
-> Read ListBuildsForProject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBuildsForProject]
$creadListPrec :: ReadPrec [ListBuildsForProject]
readPrec :: ReadPrec ListBuildsForProject
$creadPrec :: ReadPrec ListBuildsForProject
readList :: ReadS [ListBuildsForProject]
$creadList :: ReadS [ListBuildsForProject]
readsPrec :: Int -> ReadS ListBuildsForProject
$creadsPrec :: Int -> ReadS ListBuildsForProject
Prelude.Read, Int -> ListBuildsForProject -> ShowS
[ListBuildsForProject] -> ShowS
ListBuildsForProject -> String
(Int -> ListBuildsForProject -> ShowS)
-> (ListBuildsForProject -> String)
-> ([ListBuildsForProject] -> ShowS)
-> Show ListBuildsForProject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBuildsForProject] -> ShowS
$cshowList :: [ListBuildsForProject] -> ShowS
show :: ListBuildsForProject -> String
$cshow :: ListBuildsForProject -> String
showsPrec :: Int -> ListBuildsForProject -> ShowS
$cshowsPrec :: Int -> ListBuildsForProject -> ShowS
Prelude.Show, (forall x. ListBuildsForProject -> Rep ListBuildsForProject x)
-> (forall x. Rep ListBuildsForProject x -> ListBuildsForProject)
-> Generic ListBuildsForProject
forall x. Rep ListBuildsForProject x -> ListBuildsForProject
forall x. ListBuildsForProject -> Rep ListBuildsForProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBuildsForProject x -> ListBuildsForProject
$cfrom :: forall x. ListBuildsForProject -> Rep ListBuildsForProject x
Prelude.Generic)

-- |
-- Create a value of 'ListBuildsForProject' 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', 'listBuildsForProject_sortOrder' - The order to sort the results in. The results are sorted by build
-- number, not the build identifier. If this is not specified, the results
-- are sorted in descending order.
--
-- Valid values include:
--
-- -   @ASCENDING@: List the build identifiers in ascending order, by build
--     number.
--
-- -   @DESCENDING@: List the build identifiers in descending order, by
--     build number.
--
-- If the project has more than 100 builds, setting the sort order will
-- result in an error.
--
-- 'nextToken', 'listBuildsForProject_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.
--
-- 'projectName', 'listBuildsForProject_projectName' - The name of the CodeBuild project.
newListBuildsForProject ::
  -- | 'projectName'
  Prelude.Text ->
  ListBuildsForProject
newListBuildsForProject :: Text -> ListBuildsForProject
newListBuildsForProject Text
pProjectName_ =
  ListBuildsForProject' :: Maybe SortOrderType -> Maybe Text -> Text -> ListBuildsForProject
ListBuildsForProject'
    { $sel:sortOrder:ListBuildsForProject' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBuildsForProject' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:projectName:ListBuildsForProject' :: Text
projectName = Text
pProjectName_
    }

-- | The order to sort the results in. The results are sorted by build
-- number, not the build identifier. If this is not specified, the results
-- are sorted in descending order.
--
-- Valid values include:
--
-- -   @ASCENDING@: List the build identifiers in ascending order, by build
--     number.
--
-- -   @DESCENDING@: List the build identifiers in descending order, by
--     build number.
--
-- If the project has more than 100 builds, setting the sort order will
-- result in an error.
listBuildsForProject_sortOrder :: Lens.Lens' ListBuildsForProject (Prelude.Maybe SortOrderType)
listBuildsForProject_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> ListBuildsForProject -> f ListBuildsForProject
listBuildsForProject_sortOrder = (ListBuildsForProject -> Maybe SortOrderType)
-> (ListBuildsForProject
    -> Maybe SortOrderType -> ListBuildsForProject)
-> Lens
     ListBuildsForProject
     ListBuildsForProject
     (Maybe SortOrderType)
     (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBuildsForProject' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:ListBuildsForProject' :: ListBuildsForProject -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: ListBuildsForProject
s@ListBuildsForProject' {} Maybe SortOrderType
a -> ListBuildsForProject
s {$sel:sortOrder:ListBuildsForProject' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: ListBuildsForProject)

-- | 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.
listBuildsForProject_nextToken :: Lens.Lens' ListBuildsForProject (Prelude.Maybe Prelude.Text)
listBuildsForProject_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBuildsForProject -> f ListBuildsForProject
listBuildsForProject_nextToken = (ListBuildsForProject -> Maybe Text)
-> (ListBuildsForProject -> Maybe Text -> ListBuildsForProject)
-> Lens
     ListBuildsForProject ListBuildsForProject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBuildsForProject' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBuildsForProject' :: ListBuildsForProject -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBuildsForProject
s@ListBuildsForProject' {} Maybe Text
a -> ListBuildsForProject
s {$sel:nextToken:ListBuildsForProject' :: Maybe Text
nextToken = Maybe Text
a} :: ListBuildsForProject)

-- | The name of the CodeBuild project.
listBuildsForProject_projectName :: Lens.Lens' ListBuildsForProject Prelude.Text
listBuildsForProject_projectName :: (Text -> f Text) -> ListBuildsForProject -> f ListBuildsForProject
listBuildsForProject_projectName = (ListBuildsForProject -> Text)
-> (ListBuildsForProject -> Text -> ListBuildsForProject)
-> Lens ListBuildsForProject ListBuildsForProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBuildsForProject' {Text
projectName :: Text
$sel:projectName:ListBuildsForProject' :: ListBuildsForProject -> Text
projectName} -> Text
projectName) (\s :: ListBuildsForProject
s@ListBuildsForProject' {} Text
a -> ListBuildsForProject
s {$sel:projectName:ListBuildsForProject' :: Text
projectName = Text
a} :: ListBuildsForProject)

instance Core.AWSPager ListBuildsForProject where
  page :: ListBuildsForProject
-> AWSResponse ListBuildsForProject -> Maybe ListBuildsForProject
page ListBuildsForProject
rq AWSResponse ListBuildsForProject
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListBuildsForProject
ListBuildsForProjectResponse
rs
            ListBuildsForProjectResponse
-> Getting (First Text) ListBuildsForProjectResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBuildsForProjectResponse
-> Const (First Text) ListBuildsForProjectResponse
Lens' ListBuildsForProjectResponse (Maybe Text)
listBuildsForProjectResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListBuildsForProjectResponse
 -> Const (First Text) ListBuildsForProjectResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBuildsForProjectResponse 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 ListBuildsForProject
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListBuildsForProject
ListBuildsForProjectResponse
rs
            ListBuildsForProjectResponse
-> Getting (First [Text]) ListBuildsForProjectResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> ListBuildsForProjectResponse
-> Const (First [Text]) ListBuildsForProjectResponse
Lens' ListBuildsForProjectResponse (Maybe (NonEmpty Text))
listBuildsForProjectResponse_ids ((Maybe (NonEmpty Text)
  -> Const (First [Text]) (Maybe (NonEmpty Text)))
 -> ListBuildsForProjectResponse
 -> Const (First [Text]) ListBuildsForProjectResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe (NonEmpty Text)
    -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> Getting (First [Text]) ListBuildsForProjectResponse [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 ListBuildsForProject
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListBuildsForProject -> Maybe ListBuildsForProject
forall a. a -> Maybe a
Prelude.Just (ListBuildsForProject -> Maybe ListBuildsForProject)
-> ListBuildsForProject -> Maybe ListBuildsForProject
forall a b. (a -> b) -> a -> b
Prelude.$
        ListBuildsForProject
rq
          ListBuildsForProject
-> (ListBuildsForProject -> ListBuildsForProject)
-> ListBuildsForProject
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListBuildsForProject -> Identity ListBuildsForProject
Lens
  ListBuildsForProject ListBuildsForProject (Maybe Text) (Maybe Text)
listBuildsForProject_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListBuildsForProject -> Identity ListBuildsForProject)
-> Maybe Text -> ListBuildsForProject -> ListBuildsForProject
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBuildsForProject
ListBuildsForProjectResponse
rs
          ListBuildsForProjectResponse
-> Getting (First Text) ListBuildsForProjectResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBuildsForProjectResponse
-> Const (First Text) ListBuildsForProjectResponse
Lens' ListBuildsForProjectResponse (Maybe Text)
listBuildsForProjectResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListBuildsForProjectResponse
 -> Const (First Text) ListBuildsForProjectResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBuildsForProjectResponse 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 ListBuildsForProject where
  type
    AWSResponse ListBuildsForProject =
      ListBuildsForProjectResponse
  request :: ListBuildsForProject -> Request ListBuildsForProject
request = Service -> ListBuildsForProject -> Request ListBuildsForProject
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListBuildsForProject
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListBuildsForProject)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListBuildsForProject))
-> Logger
-> Service
-> Proxy ListBuildsForProject
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListBuildsForProject)))
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 (NonEmpty Text)
-> Maybe Text -> Int -> ListBuildsForProjectResponse
ListBuildsForProjectResponse'
            (Maybe (NonEmpty Text)
 -> Maybe Text -> Int -> ListBuildsForProjectResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either
     String (Maybe Text -> Int -> ListBuildsForProjectResponse)
forall (f :: * -> *) a b. Functor 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
"ids")
            Either String (Maybe Text -> Int -> ListBuildsForProjectResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListBuildsForProjectResponse)
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 -> ListBuildsForProjectResponse)
-> Either String Int -> Either String ListBuildsForProjectResponse
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 ListBuildsForProject

instance Prelude.NFData ListBuildsForProject

instance Core.ToHeaders ListBuildsForProject where
  toHeaders :: ListBuildsForProject -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListBuildsForProject -> 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.ListBuildsForProject" ::
                          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 ListBuildsForProject where
  toJSON :: ListBuildsForProject -> Value
toJSON ListBuildsForProject' {Maybe Text
Maybe SortOrderType
Text
projectName :: Text
nextToken :: Maybe Text
sortOrder :: Maybe SortOrderType
$sel:projectName:ListBuildsForProject' :: ListBuildsForProject -> Text
$sel:nextToken:ListBuildsForProject' :: ListBuildsForProject -> Maybe Text
$sel:sortOrder:ListBuildsForProject' :: ListBuildsForProject -> 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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"projectName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectName)
          ]
      )

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

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

-- | /See:/ 'newListBuildsForProjectResponse' smart constructor.
data ListBuildsForProjectResponse = ListBuildsForProjectResponse'
  { -- | A list of build identifiers for the specified build project, with each
    -- build ID representing a single build.
    ListBuildsForProjectResponse -> Maybe (NonEmpty Text)
ids :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | 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.
    ListBuildsForProjectResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListBuildsForProjectResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListBuildsForProjectResponse
-> ListBuildsForProjectResponse -> Bool
(ListBuildsForProjectResponse
 -> ListBuildsForProjectResponse -> Bool)
-> (ListBuildsForProjectResponse
    -> ListBuildsForProjectResponse -> Bool)
-> Eq ListBuildsForProjectResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBuildsForProjectResponse
-> ListBuildsForProjectResponse -> Bool
$c/= :: ListBuildsForProjectResponse
-> ListBuildsForProjectResponse -> Bool
== :: ListBuildsForProjectResponse
-> ListBuildsForProjectResponse -> Bool
$c== :: ListBuildsForProjectResponse
-> ListBuildsForProjectResponse -> Bool
Prelude.Eq, ReadPrec [ListBuildsForProjectResponse]
ReadPrec ListBuildsForProjectResponse
Int -> ReadS ListBuildsForProjectResponse
ReadS [ListBuildsForProjectResponse]
(Int -> ReadS ListBuildsForProjectResponse)
-> ReadS [ListBuildsForProjectResponse]
-> ReadPrec ListBuildsForProjectResponse
-> ReadPrec [ListBuildsForProjectResponse]
-> Read ListBuildsForProjectResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBuildsForProjectResponse]
$creadListPrec :: ReadPrec [ListBuildsForProjectResponse]
readPrec :: ReadPrec ListBuildsForProjectResponse
$creadPrec :: ReadPrec ListBuildsForProjectResponse
readList :: ReadS [ListBuildsForProjectResponse]
$creadList :: ReadS [ListBuildsForProjectResponse]
readsPrec :: Int -> ReadS ListBuildsForProjectResponse
$creadsPrec :: Int -> ReadS ListBuildsForProjectResponse
Prelude.Read, Int -> ListBuildsForProjectResponse -> ShowS
[ListBuildsForProjectResponse] -> ShowS
ListBuildsForProjectResponse -> String
(Int -> ListBuildsForProjectResponse -> ShowS)
-> (ListBuildsForProjectResponse -> String)
-> ([ListBuildsForProjectResponse] -> ShowS)
-> Show ListBuildsForProjectResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBuildsForProjectResponse] -> ShowS
$cshowList :: [ListBuildsForProjectResponse] -> ShowS
show :: ListBuildsForProjectResponse -> String
$cshow :: ListBuildsForProjectResponse -> String
showsPrec :: Int -> ListBuildsForProjectResponse -> ShowS
$cshowsPrec :: Int -> ListBuildsForProjectResponse -> ShowS
Prelude.Show, (forall x.
 ListBuildsForProjectResponse -> Rep ListBuildsForProjectResponse x)
-> (forall x.
    Rep ListBuildsForProjectResponse x -> ListBuildsForProjectResponse)
-> Generic ListBuildsForProjectResponse
forall x.
Rep ListBuildsForProjectResponse x -> ListBuildsForProjectResponse
forall x.
ListBuildsForProjectResponse -> Rep ListBuildsForProjectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListBuildsForProjectResponse x -> ListBuildsForProjectResponse
$cfrom :: forall x.
ListBuildsForProjectResponse -> Rep ListBuildsForProjectResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListBuildsForProjectResponse' 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:
--
-- 'ids', 'listBuildsForProjectResponse_ids' - A list of build identifiers for the specified build project, with each
-- build ID representing a single build.
--
-- 'nextToken', 'listBuildsForProjectResponse_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.
--
-- 'httpStatus', 'listBuildsForProjectResponse_httpStatus' - The response's http status code.
newListBuildsForProjectResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListBuildsForProjectResponse
newListBuildsForProjectResponse :: Int -> ListBuildsForProjectResponse
newListBuildsForProjectResponse Int
pHttpStatus_ =
  ListBuildsForProjectResponse' :: Maybe (NonEmpty Text)
-> Maybe Text -> Int -> ListBuildsForProjectResponse
ListBuildsForProjectResponse'
    { $sel:ids:ListBuildsForProjectResponse' :: Maybe (NonEmpty Text)
ids =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBuildsForProjectResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListBuildsForProjectResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of build identifiers for the specified build project, with each
-- build ID representing a single build.
listBuildsForProjectResponse_ids :: Lens.Lens' ListBuildsForProjectResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listBuildsForProjectResponse_ids :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListBuildsForProjectResponse -> f ListBuildsForProjectResponse
listBuildsForProjectResponse_ids = (ListBuildsForProjectResponse -> Maybe (NonEmpty Text))
-> (ListBuildsForProjectResponse
    -> Maybe (NonEmpty Text) -> ListBuildsForProjectResponse)
-> Lens' ListBuildsForProjectResponse (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBuildsForProjectResponse' {Maybe (NonEmpty Text)
ids :: Maybe (NonEmpty Text)
$sel:ids:ListBuildsForProjectResponse' :: ListBuildsForProjectResponse -> Maybe (NonEmpty Text)
ids} -> Maybe (NonEmpty Text)
ids) (\s :: ListBuildsForProjectResponse
s@ListBuildsForProjectResponse' {} Maybe (NonEmpty Text)
a -> ListBuildsForProjectResponse
s {$sel:ids:ListBuildsForProjectResponse' :: Maybe (NonEmpty Text)
ids = Maybe (NonEmpty Text)
a} :: ListBuildsForProjectResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListBuildsForProjectResponse -> f ListBuildsForProjectResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListBuildsForProjectResponse
-> f ListBuildsForProjectResponse
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

-- | 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.
listBuildsForProjectResponse_nextToken :: Lens.Lens' ListBuildsForProjectResponse (Prelude.Maybe Prelude.Text)
listBuildsForProjectResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBuildsForProjectResponse -> f ListBuildsForProjectResponse
listBuildsForProjectResponse_nextToken = (ListBuildsForProjectResponse -> Maybe Text)
-> (ListBuildsForProjectResponse
    -> Maybe Text -> ListBuildsForProjectResponse)
-> Lens' ListBuildsForProjectResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBuildsForProjectResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBuildsForProjectResponse' :: ListBuildsForProjectResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBuildsForProjectResponse
s@ListBuildsForProjectResponse' {} Maybe Text
a -> ListBuildsForProjectResponse
s {$sel:nextToken:ListBuildsForProjectResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBuildsForProjectResponse)

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

instance Prelude.NFData ListBuildsForProjectResponse