{-# 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.DescribeCodeCoverages
-- 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)
--
-- Retrieves one or more code coverage reports.
--
-- This operation returns paginated results.
module Amazonka.CodeBuild.DescribeCodeCoverages
  ( -- * Creating a Request
    DescribeCodeCoverages (..),
    newDescribeCodeCoverages,

    -- * Request Lenses
    describeCodeCoverages_minLineCoveragePercentage,
    describeCodeCoverages_sortOrder,
    describeCodeCoverages_maxLineCoveragePercentage,
    describeCodeCoverages_nextToken,
    describeCodeCoverages_maxResults,
    describeCodeCoverages_sortBy,
    describeCodeCoverages_reportArn,

    -- * Destructuring the Response
    DescribeCodeCoveragesResponse (..),
    newDescribeCodeCoveragesResponse,

    -- * Response Lenses
    describeCodeCoveragesResponse_codeCoverages,
    describeCodeCoveragesResponse_nextToken,
    describeCodeCoveragesResponse_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:/ 'newDescribeCodeCoverages' smart constructor.
data DescribeCodeCoverages = DescribeCodeCoverages'
  { -- | The minimum line coverage percentage to report.
    DescribeCodeCoverages -> Maybe Double
minLineCoveragePercentage :: Prelude.Maybe Prelude.Double,
    -- | Specifies if the results are sorted in ascending or descending order.
    DescribeCodeCoverages -> Maybe SortOrderType
sortOrder :: Prelude.Maybe SortOrderType,
    -- | The maximum line coverage percentage to report.
    DescribeCodeCoverages -> Maybe Double
maxLineCoveragePercentage :: Prelude.Maybe Prelude.Double,
    -- | The @nextToken@ value returned from a previous call to
    -- @DescribeCodeCoverages@. This specifies the next item to return. To
    -- return the beginning of the list, exclude this parameter.
    DescribeCodeCoverages -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    DescribeCodeCoverages -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Specifies how the results are sorted. Possible values are:
    --
    -- [FILE_PATH]
    --     The results are sorted by file path.
    --
    -- [LINE_COVERAGE_PERCENTAGE]
    --     The results are sorted by the percentage of lines that are covered.
    DescribeCodeCoverages -> Maybe ReportCodeCoverageSortByType
sortBy :: Prelude.Maybe ReportCodeCoverageSortByType,
    -- | The ARN of the report for which test cases are returned.
    DescribeCodeCoverages -> Text
reportArn :: Prelude.Text
  }
  deriving (DescribeCodeCoverages -> DescribeCodeCoverages -> Bool
(DescribeCodeCoverages -> DescribeCodeCoverages -> Bool)
-> (DescribeCodeCoverages -> DescribeCodeCoverages -> Bool)
-> Eq DescribeCodeCoverages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCodeCoverages -> DescribeCodeCoverages -> Bool
$c/= :: DescribeCodeCoverages -> DescribeCodeCoverages -> Bool
== :: DescribeCodeCoverages -> DescribeCodeCoverages -> Bool
$c== :: DescribeCodeCoverages -> DescribeCodeCoverages -> Bool
Prelude.Eq, ReadPrec [DescribeCodeCoverages]
ReadPrec DescribeCodeCoverages
Int -> ReadS DescribeCodeCoverages
ReadS [DescribeCodeCoverages]
(Int -> ReadS DescribeCodeCoverages)
-> ReadS [DescribeCodeCoverages]
-> ReadPrec DescribeCodeCoverages
-> ReadPrec [DescribeCodeCoverages]
-> Read DescribeCodeCoverages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCodeCoverages]
$creadListPrec :: ReadPrec [DescribeCodeCoverages]
readPrec :: ReadPrec DescribeCodeCoverages
$creadPrec :: ReadPrec DescribeCodeCoverages
readList :: ReadS [DescribeCodeCoverages]
$creadList :: ReadS [DescribeCodeCoverages]
readsPrec :: Int -> ReadS DescribeCodeCoverages
$creadsPrec :: Int -> ReadS DescribeCodeCoverages
Prelude.Read, Int -> DescribeCodeCoverages -> ShowS
[DescribeCodeCoverages] -> ShowS
DescribeCodeCoverages -> String
(Int -> DescribeCodeCoverages -> ShowS)
-> (DescribeCodeCoverages -> String)
-> ([DescribeCodeCoverages] -> ShowS)
-> Show DescribeCodeCoverages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCodeCoverages] -> ShowS
$cshowList :: [DescribeCodeCoverages] -> ShowS
show :: DescribeCodeCoverages -> String
$cshow :: DescribeCodeCoverages -> String
showsPrec :: Int -> DescribeCodeCoverages -> ShowS
$cshowsPrec :: Int -> DescribeCodeCoverages -> ShowS
Prelude.Show, (forall x. DescribeCodeCoverages -> Rep DescribeCodeCoverages x)
-> (forall x. Rep DescribeCodeCoverages x -> DescribeCodeCoverages)
-> Generic DescribeCodeCoverages
forall x. Rep DescribeCodeCoverages x -> DescribeCodeCoverages
forall x. DescribeCodeCoverages -> Rep DescribeCodeCoverages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCodeCoverages x -> DescribeCodeCoverages
$cfrom :: forall x. DescribeCodeCoverages -> Rep DescribeCodeCoverages x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCodeCoverages' 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:
--
-- 'minLineCoveragePercentage', 'describeCodeCoverages_minLineCoveragePercentage' - The minimum line coverage percentage to report.
--
-- 'sortOrder', 'describeCodeCoverages_sortOrder' - Specifies if the results are sorted in ascending or descending order.
--
-- 'maxLineCoveragePercentage', 'describeCodeCoverages_maxLineCoveragePercentage' - The maximum line coverage percentage to report.
--
-- 'nextToken', 'describeCodeCoverages_nextToken' - The @nextToken@ value returned from a previous call to
-- @DescribeCodeCoverages@. This specifies the next item to return. To
-- return the beginning of the list, exclude this parameter.
--
-- 'maxResults', 'describeCodeCoverages_maxResults' - The maximum number of results to return.
--
-- 'sortBy', 'describeCodeCoverages_sortBy' - Specifies how the results are sorted. Possible values are:
--
-- [FILE_PATH]
--     The results are sorted by file path.
--
-- [LINE_COVERAGE_PERCENTAGE]
--     The results are sorted by the percentage of lines that are covered.
--
-- 'reportArn', 'describeCodeCoverages_reportArn' - The ARN of the report for which test cases are returned.
newDescribeCodeCoverages ::
  -- | 'reportArn'
  Prelude.Text ->
  DescribeCodeCoverages
newDescribeCodeCoverages :: Text -> DescribeCodeCoverages
newDescribeCodeCoverages Text
pReportArn_ =
  DescribeCodeCoverages' :: Maybe Double
-> Maybe SortOrderType
-> Maybe Double
-> Maybe Text
-> Maybe Natural
-> Maybe ReportCodeCoverageSortByType
-> Text
-> DescribeCodeCoverages
DescribeCodeCoverages'
    { $sel:minLineCoveragePercentage:DescribeCodeCoverages' :: Maybe Double
minLineCoveragePercentage =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:DescribeCodeCoverages' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:maxLineCoveragePercentage:DescribeCodeCoverages' :: Maybe Double
maxLineCoveragePercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeCodeCoverages' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeCodeCoverages' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:DescribeCodeCoverages' :: Maybe ReportCodeCoverageSortByType
sortBy = Maybe ReportCodeCoverageSortByType
forall a. Maybe a
Prelude.Nothing,
      $sel:reportArn:DescribeCodeCoverages' :: Text
reportArn = Text
pReportArn_
    }

-- | The minimum line coverage percentage to report.
describeCodeCoverages_minLineCoveragePercentage :: Lens.Lens' DescribeCodeCoverages (Prelude.Maybe Prelude.Double)
describeCodeCoverages_minLineCoveragePercentage :: (Maybe Double -> f (Maybe Double))
-> DescribeCodeCoverages -> f DescribeCodeCoverages
describeCodeCoverages_minLineCoveragePercentage = (DescribeCodeCoverages -> Maybe Double)
-> (DescribeCodeCoverages -> Maybe Double -> DescribeCodeCoverages)
-> Lens
     DescribeCodeCoverages
     DescribeCodeCoverages
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoverages' {Maybe Double
minLineCoveragePercentage :: Maybe Double
$sel:minLineCoveragePercentage:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Double
minLineCoveragePercentage} -> Maybe Double
minLineCoveragePercentage) (\s :: DescribeCodeCoverages
s@DescribeCodeCoverages' {} Maybe Double
a -> DescribeCodeCoverages
s {$sel:minLineCoveragePercentage:DescribeCodeCoverages' :: Maybe Double
minLineCoveragePercentage = Maybe Double
a} :: DescribeCodeCoverages)

-- | Specifies if the results are sorted in ascending or descending order.
describeCodeCoverages_sortOrder :: Lens.Lens' DescribeCodeCoverages (Prelude.Maybe SortOrderType)
describeCodeCoverages_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> DescribeCodeCoverages -> f DescribeCodeCoverages
describeCodeCoverages_sortOrder = (DescribeCodeCoverages -> Maybe SortOrderType)
-> (DescribeCodeCoverages
    -> Maybe SortOrderType -> DescribeCodeCoverages)
-> Lens
     DescribeCodeCoverages
     DescribeCodeCoverages
     (Maybe SortOrderType)
     (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoverages' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: DescribeCodeCoverages
s@DescribeCodeCoverages' {} Maybe SortOrderType
a -> DescribeCodeCoverages
s {$sel:sortOrder:DescribeCodeCoverages' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: DescribeCodeCoverages)

-- | The maximum line coverage percentage to report.
describeCodeCoverages_maxLineCoveragePercentage :: Lens.Lens' DescribeCodeCoverages (Prelude.Maybe Prelude.Double)
describeCodeCoverages_maxLineCoveragePercentage :: (Maybe Double -> f (Maybe Double))
-> DescribeCodeCoverages -> f DescribeCodeCoverages
describeCodeCoverages_maxLineCoveragePercentage = (DescribeCodeCoverages -> Maybe Double)
-> (DescribeCodeCoverages -> Maybe Double -> DescribeCodeCoverages)
-> Lens
     DescribeCodeCoverages
     DescribeCodeCoverages
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoverages' {Maybe Double
maxLineCoveragePercentage :: Maybe Double
$sel:maxLineCoveragePercentage:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Double
maxLineCoveragePercentage} -> Maybe Double
maxLineCoveragePercentage) (\s :: DescribeCodeCoverages
s@DescribeCodeCoverages' {} Maybe Double
a -> DescribeCodeCoverages
s {$sel:maxLineCoveragePercentage:DescribeCodeCoverages' :: Maybe Double
maxLineCoveragePercentage = Maybe Double
a} :: DescribeCodeCoverages)

-- | The @nextToken@ value returned from a previous call to
-- @DescribeCodeCoverages@. This specifies the next item to return. To
-- return the beginning of the list, exclude this parameter.
describeCodeCoverages_nextToken :: Lens.Lens' DescribeCodeCoverages (Prelude.Maybe Prelude.Text)
describeCodeCoverages_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeCodeCoverages -> f DescribeCodeCoverages
describeCodeCoverages_nextToken = (DescribeCodeCoverages -> Maybe Text)
-> (DescribeCodeCoverages -> Maybe Text -> DescribeCodeCoverages)
-> Lens
     DescribeCodeCoverages
     DescribeCodeCoverages
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoverages' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCodeCoverages
s@DescribeCodeCoverages' {} Maybe Text
a -> DescribeCodeCoverages
s {$sel:nextToken:DescribeCodeCoverages' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCodeCoverages)

-- | The maximum number of results to return.
describeCodeCoverages_maxResults :: Lens.Lens' DescribeCodeCoverages (Prelude.Maybe Prelude.Natural)
describeCodeCoverages_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeCodeCoverages -> f DescribeCodeCoverages
describeCodeCoverages_maxResults = (DescribeCodeCoverages -> Maybe Natural)
-> (DescribeCodeCoverages
    -> Maybe Natural -> DescribeCodeCoverages)
-> Lens
     DescribeCodeCoverages
     DescribeCodeCoverages
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoverages' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeCodeCoverages
s@DescribeCodeCoverages' {} Maybe Natural
a -> DescribeCodeCoverages
s {$sel:maxResults:DescribeCodeCoverages' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeCodeCoverages)

-- | Specifies how the results are sorted. Possible values are:
--
-- [FILE_PATH]
--     The results are sorted by file path.
--
-- [LINE_COVERAGE_PERCENTAGE]
--     The results are sorted by the percentage of lines that are covered.
describeCodeCoverages_sortBy :: Lens.Lens' DescribeCodeCoverages (Prelude.Maybe ReportCodeCoverageSortByType)
describeCodeCoverages_sortBy :: (Maybe ReportCodeCoverageSortByType
 -> f (Maybe ReportCodeCoverageSortByType))
-> DescribeCodeCoverages -> f DescribeCodeCoverages
describeCodeCoverages_sortBy = (DescribeCodeCoverages -> Maybe ReportCodeCoverageSortByType)
-> (DescribeCodeCoverages
    -> Maybe ReportCodeCoverageSortByType -> DescribeCodeCoverages)
-> Lens
     DescribeCodeCoverages
     DescribeCodeCoverages
     (Maybe ReportCodeCoverageSortByType)
     (Maybe ReportCodeCoverageSortByType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoverages' {Maybe ReportCodeCoverageSortByType
sortBy :: Maybe ReportCodeCoverageSortByType
$sel:sortBy:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe ReportCodeCoverageSortByType
sortBy} -> Maybe ReportCodeCoverageSortByType
sortBy) (\s :: DescribeCodeCoverages
s@DescribeCodeCoverages' {} Maybe ReportCodeCoverageSortByType
a -> DescribeCodeCoverages
s {$sel:sortBy:DescribeCodeCoverages' :: Maybe ReportCodeCoverageSortByType
sortBy = Maybe ReportCodeCoverageSortByType
a} :: DescribeCodeCoverages)

-- | The ARN of the report for which test cases are returned.
describeCodeCoverages_reportArn :: Lens.Lens' DescribeCodeCoverages Prelude.Text
describeCodeCoverages_reportArn :: (Text -> f Text)
-> DescribeCodeCoverages -> f DescribeCodeCoverages
describeCodeCoverages_reportArn = (DescribeCodeCoverages -> Text)
-> (DescribeCodeCoverages -> Text -> DescribeCodeCoverages)
-> Lens DescribeCodeCoverages DescribeCodeCoverages Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoverages' {Text
reportArn :: Text
$sel:reportArn:DescribeCodeCoverages' :: DescribeCodeCoverages -> Text
reportArn} -> Text
reportArn) (\s :: DescribeCodeCoverages
s@DescribeCodeCoverages' {} Text
a -> DescribeCodeCoverages
s {$sel:reportArn:DescribeCodeCoverages' :: Text
reportArn = Text
a} :: DescribeCodeCoverages)

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

instance Prelude.NFData DescribeCodeCoverages

instance Core.ToHeaders DescribeCodeCoverages where
  toHeaders :: DescribeCodeCoverages -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeCodeCoverages -> 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.DescribeCodeCoverages" ::
                          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 DescribeCodeCoverages where
  toJSON :: DescribeCodeCoverages -> Value
toJSON DescribeCodeCoverages' {Maybe Double
Maybe Natural
Maybe Text
Maybe ReportCodeCoverageSortByType
Maybe SortOrderType
Text
reportArn :: Text
sortBy :: Maybe ReportCodeCoverageSortByType
maxResults :: Maybe Natural
nextToken :: Maybe Text
maxLineCoveragePercentage :: Maybe Double
sortOrder :: Maybe SortOrderType
minLineCoveragePercentage :: Maybe Double
$sel:reportArn:DescribeCodeCoverages' :: DescribeCodeCoverages -> Text
$sel:sortBy:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe ReportCodeCoverageSortByType
$sel:maxResults:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Natural
$sel:nextToken:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Text
$sel:maxLineCoveragePercentage:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Double
$sel:sortOrder:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe SortOrderType
$sel:minLineCoveragePercentage:DescribeCodeCoverages' :: DescribeCodeCoverages -> Maybe Double
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"minLineCoveragePercentage" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minLineCoveragePercentage,
            (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
"maxLineCoveragePercentage" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
maxLineCoveragePercentage,
            (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
"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 -> ReportCodeCoverageSortByType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ReportCodeCoverageSortByType -> Pair)
-> Maybe ReportCodeCoverageSortByType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReportCodeCoverageSortByType
sortBy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"reportArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
reportArn)
          ]
      )

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

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

-- | /See:/ 'newDescribeCodeCoveragesResponse' smart constructor.
data DescribeCodeCoveragesResponse = DescribeCodeCoveragesResponse'
  { -- | An array of @CodeCoverage@ objects that contain the results.
    DescribeCodeCoveragesResponse -> Maybe [CodeCoverage]
codeCoverages :: Prelude.Maybe [CodeCoverage],
    -- | If there are more items to return, this contains a token that is passed
    -- to a subsequent call to @DescribeCodeCoverages@ to retrieve the next set
    -- of items.
    DescribeCodeCoveragesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeCodeCoveragesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCodeCoveragesResponse
-> DescribeCodeCoveragesResponse -> Bool
(DescribeCodeCoveragesResponse
 -> DescribeCodeCoveragesResponse -> Bool)
-> (DescribeCodeCoveragesResponse
    -> DescribeCodeCoveragesResponse -> Bool)
-> Eq DescribeCodeCoveragesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCodeCoveragesResponse
-> DescribeCodeCoveragesResponse -> Bool
$c/= :: DescribeCodeCoveragesResponse
-> DescribeCodeCoveragesResponse -> Bool
== :: DescribeCodeCoveragesResponse
-> DescribeCodeCoveragesResponse -> Bool
$c== :: DescribeCodeCoveragesResponse
-> DescribeCodeCoveragesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCodeCoveragesResponse]
ReadPrec DescribeCodeCoveragesResponse
Int -> ReadS DescribeCodeCoveragesResponse
ReadS [DescribeCodeCoveragesResponse]
(Int -> ReadS DescribeCodeCoveragesResponse)
-> ReadS [DescribeCodeCoveragesResponse]
-> ReadPrec DescribeCodeCoveragesResponse
-> ReadPrec [DescribeCodeCoveragesResponse]
-> Read DescribeCodeCoveragesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCodeCoveragesResponse]
$creadListPrec :: ReadPrec [DescribeCodeCoveragesResponse]
readPrec :: ReadPrec DescribeCodeCoveragesResponse
$creadPrec :: ReadPrec DescribeCodeCoveragesResponse
readList :: ReadS [DescribeCodeCoveragesResponse]
$creadList :: ReadS [DescribeCodeCoveragesResponse]
readsPrec :: Int -> ReadS DescribeCodeCoveragesResponse
$creadsPrec :: Int -> ReadS DescribeCodeCoveragesResponse
Prelude.Read, Int -> DescribeCodeCoveragesResponse -> ShowS
[DescribeCodeCoveragesResponse] -> ShowS
DescribeCodeCoveragesResponse -> String
(Int -> DescribeCodeCoveragesResponse -> ShowS)
-> (DescribeCodeCoveragesResponse -> String)
-> ([DescribeCodeCoveragesResponse] -> ShowS)
-> Show DescribeCodeCoveragesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCodeCoveragesResponse] -> ShowS
$cshowList :: [DescribeCodeCoveragesResponse] -> ShowS
show :: DescribeCodeCoveragesResponse -> String
$cshow :: DescribeCodeCoveragesResponse -> String
showsPrec :: Int -> DescribeCodeCoveragesResponse -> ShowS
$cshowsPrec :: Int -> DescribeCodeCoveragesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeCodeCoveragesResponse
 -> Rep DescribeCodeCoveragesResponse x)
-> (forall x.
    Rep DescribeCodeCoveragesResponse x
    -> DescribeCodeCoveragesResponse)
-> Generic DescribeCodeCoveragesResponse
forall x.
Rep DescribeCodeCoveragesResponse x
-> DescribeCodeCoveragesResponse
forall x.
DescribeCodeCoveragesResponse
-> Rep DescribeCodeCoveragesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCodeCoveragesResponse x
-> DescribeCodeCoveragesResponse
$cfrom :: forall x.
DescribeCodeCoveragesResponse
-> Rep DescribeCodeCoveragesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCodeCoveragesResponse' 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:
--
-- 'codeCoverages', 'describeCodeCoveragesResponse_codeCoverages' - An array of @CodeCoverage@ objects that contain the results.
--
-- 'nextToken', 'describeCodeCoveragesResponse_nextToken' - If there are more items to return, this contains a token that is passed
-- to a subsequent call to @DescribeCodeCoverages@ to retrieve the next set
-- of items.
--
-- 'httpStatus', 'describeCodeCoveragesResponse_httpStatus' - The response's http status code.
newDescribeCodeCoveragesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCodeCoveragesResponse
newDescribeCodeCoveragesResponse :: Int -> DescribeCodeCoveragesResponse
newDescribeCodeCoveragesResponse Int
pHttpStatus_ =
  DescribeCodeCoveragesResponse' :: Maybe [CodeCoverage]
-> Maybe Text -> Int -> DescribeCodeCoveragesResponse
DescribeCodeCoveragesResponse'
    { $sel:codeCoverages:DescribeCodeCoveragesResponse' :: Maybe [CodeCoverage]
codeCoverages =
        Maybe [CodeCoverage]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeCodeCoveragesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCodeCoveragesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of @CodeCoverage@ objects that contain the results.
describeCodeCoveragesResponse_codeCoverages :: Lens.Lens' DescribeCodeCoveragesResponse (Prelude.Maybe [CodeCoverage])
describeCodeCoveragesResponse_codeCoverages :: (Maybe [CodeCoverage] -> f (Maybe [CodeCoverage]))
-> DescribeCodeCoveragesResponse -> f DescribeCodeCoveragesResponse
describeCodeCoveragesResponse_codeCoverages = (DescribeCodeCoveragesResponse -> Maybe [CodeCoverage])
-> (DescribeCodeCoveragesResponse
    -> Maybe [CodeCoverage] -> DescribeCodeCoveragesResponse)
-> Lens' DescribeCodeCoveragesResponse (Maybe [CodeCoverage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoveragesResponse' {Maybe [CodeCoverage]
codeCoverages :: Maybe [CodeCoverage]
$sel:codeCoverages:DescribeCodeCoveragesResponse' :: DescribeCodeCoveragesResponse -> Maybe [CodeCoverage]
codeCoverages} -> Maybe [CodeCoverage]
codeCoverages) (\s :: DescribeCodeCoveragesResponse
s@DescribeCodeCoveragesResponse' {} Maybe [CodeCoverage]
a -> DescribeCodeCoveragesResponse
s {$sel:codeCoverages:DescribeCodeCoveragesResponse' :: Maybe [CodeCoverage]
codeCoverages = Maybe [CodeCoverage]
a} :: DescribeCodeCoveragesResponse) ((Maybe [CodeCoverage] -> f (Maybe [CodeCoverage]))
 -> DescribeCodeCoveragesResponse
 -> f DescribeCodeCoveragesResponse)
-> ((Maybe [CodeCoverage] -> f (Maybe [CodeCoverage]))
    -> Maybe [CodeCoverage] -> f (Maybe [CodeCoverage]))
-> (Maybe [CodeCoverage] -> f (Maybe [CodeCoverage]))
-> DescribeCodeCoveragesResponse
-> f DescribeCodeCoveragesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CodeCoverage] [CodeCoverage] [CodeCoverage] [CodeCoverage]
-> Iso
     (Maybe [CodeCoverage])
     (Maybe [CodeCoverage])
     (Maybe [CodeCoverage])
     (Maybe [CodeCoverage])
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 [CodeCoverage] [CodeCoverage] [CodeCoverage] [CodeCoverage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If there are more items to return, this contains a token that is passed
-- to a subsequent call to @DescribeCodeCoverages@ to retrieve the next set
-- of items.
describeCodeCoveragesResponse_nextToken :: Lens.Lens' DescribeCodeCoveragesResponse (Prelude.Maybe Prelude.Text)
describeCodeCoveragesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeCodeCoveragesResponse -> f DescribeCodeCoveragesResponse
describeCodeCoveragesResponse_nextToken = (DescribeCodeCoveragesResponse -> Maybe Text)
-> (DescribeCodeCoveragesResponse
    -> Maybe Text -> DescribeCodeCoveragesResponse)
-> Lens' DescribeCodeCoveragesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCodeCoveragesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCodeCoveragesResponse' :: DescribeCodeCoveragesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCodeCoveragesResponse
s@DescribeCodeCoveragesResponse' {} Maybe Text
a -> DescribeCodeCoveragesResponse
s {$sel:nextToken:DescribeCodeCoveragesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCodeCoveragesResponse)

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

instance Prelude.NFData DescribeCodeCoveragesResponse