{-# 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.ListReportsForReportGroup
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of ARNs for the reports that belong to a @ReportGroup@.
--
-- This operation returns paginated results.
module Amazonka.CodeBuild.ListReportsForReportGroup
  ( -- * Creating a Request
    ListReportsForReportGroup (..),
    newListReportsForReportGroup,

    -- * Request Lenses
    listReportsForReportGroup_sortOrder,
    listReportsForReportGroup_nextToken,
    listReportsForReportGroup_filter,
    listReportsForReportGroup_maxResults,
    listReportsForReportGroup_reportGroupArn,

    -- * Destructuring the Response
    ListReportsForReportGroupResponse (..),
    newListReportsForReportGroupResponse,

    -- * Response Lenses
    listReportsForReportGroupResponse_reports,
    listReportsForReportGroupResponse_nextToken,
    listReportsForReportGroupResponse_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:/ 'newListReportsForReportGroup' smart constructor.
data ListReportsForReportGroup = ListReportsForReportGroup'
  { -- | Use to specify whether the results are returned in ascending or
    -- descending order.
    ListReportsForReportGroup -> Maybe SortOrderType
sortOrder :: Prelude.Maybe SortOrderType,
    -- | During a previous call, the maximum number of items that can be returned
    -- is the value specified in @maxResults@. If there more items in the list,
    -- then a unique string called a /nextToken/ is returned. 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.
    ListReportsForReportGroup -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A @ReportFilter@ object used to filter the returned reports.
    ListReportsForReportGroup -> Maybe ReportFilter
filter' :: Prelude.Maybe ReportFilter,
    -- | The maximum number of paginated reports in this report group returned
    -- per response. Use @nextToken@ to iterate pages in the list of returned
    -- @Report@ objects. The default value is 100.
    ListReportsForReportGroup -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ARN of the report group for which you want to return report ARNs.
    ListReportsForReportGroup -> Text
reportGroupArn :: Prelude.Text
  }
  deriving (ListReportsForReportGroup -> ListReportsForReportGroup -> Bool
(ListReportsForReportGroup -> ListReportsForReportGroup -> Bool)
-> (ListReportsForReportGroup -> ListReportsForReportGroup -> Bool)
-> Eq ListReportsForReportGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportsForReportGroup -> ListReportsForReportGroup -> Bool
$c/= :: ListReportsForReportGroup -> ListReportsForReportGroup -> Bool
== :: ListReportsForReportGroup -> ListReportsForReportGroup -> Bool
$c== :: ListReportsForReportGroup -> ListReportsForReportGroup -> Bool
Prelude.Eq, ReadPrec [ListReportsForReportGroup]
ReadPrec ListReportsForReportGroup
Int -> ReadS ListReportsForReportGroup
ReadS [ListReportsForReportGroup]
(Int -> ReadS ListReportsForReportGroup)
-> ReadS [ListReportsForReportGroup]
-> ReadPrec ListReportsForReportGroup
-> ReadPrec [ListReportsForReportGroup]
-> Read ListReportsForReportGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportsForReportGroup]
$creadListPrec :: ReadPrec [ListReportsForReportGroup]
readPrec :: ReadPrec ListReportsForReportGroup
$creadPrec :: ReadPrec ListReportsForReportGroup
readList :: ReadS [ListReportsForReportGroup]
$creadList :: ReadS [ListReportsForReportGroup]
readsPrec :: Int -> ReadS ListReportsForReportGroup
$creadsPrec :: Int -> ReadS ListReportsForReportGroup
Prelude.Read, Int -> ListReportsForReportGroup -> ShowS
[ListReportsForReportGroup] -> ShowS
ListReportsForReportGroup -> String
(Int -> ListReportsForReportGroup -> ShowS)
-> (ListReportsForReportGroup -> String)
-> ([ListReportsForReportGroup] -> ShowS)
-> Show ListReportsForReportGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportsForReportGroup] -> ShowS
$cshowList :: [ListReportsForReportGroup] -> ShowS
show :: ListReportsForReportGroup -> String
$cshow :: ListReportsForReportGroup -> String
showsPrec :: Int -> ListReportsForReportGroup -> ShowS
$cshowsPrec :: Int -> ListReportsForReportGroup -> ShowS
Prelude.Show, (forall x.
 ListReportsForReportGroup -> Rep ListReportsForReportGroup x)
-> (forall x.
    Rep ListReportsForReportGroup x -> ListReportsForReportGroup)
-> Generic ListReportsForReportGroup
forall x.
Rep ListReportsForReportGroup x -> ListReportsForReportGroup
forall x.
ListReportsForReportGroup -> Rep ListReportsForReportGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListReportsForReportGroup x -> ListReportsForReportGroup
$cfrom :: forall x.
ListReportsForReportGroup -> Rep ListReportsForReportGroup x
Prelude.Generic)

-- |
-- Create a value of 'ListReportsForReportGroup' 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', 'listReportsForReportGroup_sortOrder' - Use to specify whether the results are returned in ascending or
-- descending order.
--
-- 'nextToken', 'listReportsForReportGroup_nextToken' - During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
--
-- 'filter'', 'listReportsForReportGroup_filter' - A @ReportFilter@ object used to filter the returned reports.
--
-- 'maxResults', 'listReportsForReportGroup_maxResults' - The maximum number of paginated reports in this report group returned
-- per response. Use @nextToken@ to iterate pages in the list of returned
-- @Report@ objects. The default value is 100.
--
-- 'reportGroupArn', 'listReportsForReportGroup_reportGroupArn' - The ARN of the report group for which you want to return report ARNs.
newListReportsForReportGroup ::
  -- | 'reportGroupArn'
  Prelude.Text ->
  ListReportsForReportGroup
newListReportsForReportGroup :: Text -> ListReportsForReportGroup
newListReportsForReportGroup Text
pReportGroupArn_ =
  ListReportsForReportGroup' :: Maybe SortOrderType
-> Maybe Text
-> Maybe ReportFilter
-> Maybe Natural
-> Text
-> ListReportsForReportGroup
ListReportsForReportGroup'
    { $sel:sortOrder:ListReportsForReportGroup' :: Maybe SortOrderType
sortOrder =
        Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListReportsForReportGroup' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListReportsForReportGroup' :: Maybe ReportFilter
filter' = Maybe ReportFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListReportsForReportGroup' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:reportGroupArn:ListReportsForReportGroup' :: Text
reportGroupArn = Text
pReportGroupArn_
    }

-- | Use to specify whether the results are returned in ascending or
-- descending order.
listReportsForReportGroup_sortOrder :: Lens.Lens' ListReportsForReportGroup (Prelude.Maybe SortOrderType)
listReportsForReportGroup_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> ListReportsForReportGroup -> f ListReportsForReportGroup
listReportsForReportGroup_sortOrder = (ListReportsForReportGroup -> Maybe SortOrderType)
-> (ListReportsForReportGroup
    -> Maybe SortOrderType -> ListReportsForReportGroup)
-> Lens
     ListReportsForReportGroup
     ListReportsForReportGroup
     (Maybe SortOrderType)
     (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportsForReportGroup' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:ListReportsForReportGroup' :: ListReportsForReportGroup -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: ListReportsForReportGroup
s@ListReportsForReportGroup' {} Maybe SortOrderType
a -> ListReportsForReportGroup
s {$sel:sortOrder:ListReportsForReportGroup' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: ListReportsForReportGroup)

-- | During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
listReportsForReportGroup_nextToken :: Lens.Lens' ListReportsForReportGroup (Prelude.Maybe Prelude.Text)
listReportsForReportGroup_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListReportsForReportGroup -> f ListReportsForReportGroup
listReportsForReportGroup_nextToken = (ListReportsForReportGroup -> Maybe Text)
-> (ListReportsForReportGroup
    -> Maybe Text -> ListReportsForReportGroup)
-> Lens
     ListReportsForReportGroup
     ListReportsForReportGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportsForReportGroup' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReportsForReportGroup' :: ListReportsForReportGroup -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReportsForReportGroup
s@ListReportsForReportGroup' {} Maybe Text
a -> ListReportsForReportGroup
s {$sel:nextToken:ListReportsForReportGroup' :: Maybe Text
nextToken = Maybe Text
a} :: ListReportsForReportGroup)

-- | A @ReportFilter@ object used to filter the returned reports.
listReportsForReportGroup_filter :: Lens.Lens' ListReportsForReportGroup (Prelude.Maybe ReportFilter)
listReportsForReportGroup_filter :: (Maybe ReportFilter -> f (Maybe ReportFilter))
-> ListReportsForReportGroup -> f ListReportsForReportGroup
listReportsForReportGroup_filter = (ListReportsForReportGroup -> Maybe ReportFilter)
-> (ListReportsForReportGroup
    -> Maybe ReportFilter -> ListReportsForReportGroup)
-> Lens
     ListReportsForReportGroup
     ListReportsForReportGroup
     (Maybe ReportFilter)
     (Maybe ReportFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportsForReportGroup' {Maybe ReportFilter
filter' :: Maybe ReportFilter
$sel:filter':ListReportsForReportGroup' :: ListReportsForReportGroup -> Maybe ReportFilter
filter'} -> Maybe ReportFilter
filter') (\s :: ListReportsForReportGroup
s@ListReportsForReportGroup' {} Maybe ReportFilter
a -> ListReportsForReportGroup
s {$sel:filter':ListReportsForReportGroup' :: Maybe ReportFilter
filter' = Maybe ReportFilter
a} :: ListReportsForReportGroup)

-- | The maximum number of paginated reports in this report group returned
-- per response. Use @nextToken@ to iterate pages in the list of returned
-- @Report@ objects. The default value is 100.
listReportsForReportGroup_maxResults :: Lens.Lens' ListReportsForReportGroup (Prelude.Maybe Prelude.Natural)
listReportsForReportGroup_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListReportsForReportGroup -> f ListReportsForReportGroup
listReportsForReportGroup_maxResults = (ListReportsForReportGroup -> Maybe Natural)
-> (ListReportsForReportGroup
    -> Maybe Natural -> ListReportsForReportGroup)
-> Lens
     ListReportsForReportGroup
     ListReportsForReportGroup
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportsForReportGroup' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListReportsForReportGroup' :: ListReportsForReportGroup -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListReportsForReportGroup
s@ListReportsForReportGroup' {} Maybe Natural
a -> ListReportsForReportGroup
s {$sel:maxResults:ListReportsForReportGroup' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListReportsForReportGroup)

-- | The ARN of the report group for which you want to return report ARNs.
listReportsForReportGroup_reportGroupArn :: Lens.Lens' ListReportsForReportGroup Prelude.Text
listReportsForReportGroup_reportGroupArn :: (Text -> f Text)
-> ListReportsForReportGroup -> f ListReportsForReportGroup
listReportsForReportGroup_reportGroupArn = (ListReportsForReportGroup -> Text)
-> (ListReportsForReportGroup -> Text -> ListReportsForReportGroup)
-> Lens
     ListReportsForReportGroup ListReportsForReportGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportsForReportGroup' {Text
reportGroupArn :: Text
$sel:reportGroupArn:ListReportsForReportGroup' :: ListReportsForReportGroup -> Text
reportGroupArn} -> Text
reportGroupArn) (\s :: ListReportsForReportGroup
s@ListReportsForReportGroup' {} Text
a -> ListReportsForReportGroup
s {$sel:reportGroupArn:ListReportsForReportGroup' :: Text
reportGroupArn = Text
a} :: ListReportsForReportGroup)

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

instance Prelude.NFData ListReportsForReportGroup

instance Core.ToHeaders ListReportsForReportGroup where
  toHeaders :: ListReportsForReportGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListReportsForReportGroup -> 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.ListReportsForReportGroup" ::
                          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 ListReportsForReportGroup where
  toJSON :: ListReportsForReportGroup -> Value
toJSON ListReportsForReportGroup' {Maybe Natural
Maybe Text
Maybe ReportFilter
Maybe SortOrderType
Text
reportGroupArn :: Text
maxResults :: Maybe Natural
filter' :: Maybe ReportFilter
nextToken :: Maybe Text
sortOrder :: Maybe SortOrderType
$sel:reportGroupArn:ListReportsForReportGroup' :: ListReportsForReportGroup -> Text
$sel:maxResults:ListReportsForReportGroup' :: ListReportsForReportGroup -> Maybe Natural
$sel:filter':ListReportsForReportGroup' :: ListReportsForReportGroup -> Maybe ReportFilter
$sel:nextToken:ListReportsForReportGroup' :: ListReportsForReportGroup -> Maybe Text
$sel:sortOrder:ListReportsForReportGroup' :: ListReportsForReportGroup -> 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
"filter" Text -> ReportFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ReportFilter -> Pair) -> Maybe ReportFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReportFilter
filter',
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"reportGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
reportGroupArn)
          ]
      )

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

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

-- | /See:/ 'newListReportsForReportGroupResponse' smart constructor.
data ListReportsForReportGroupResponse = ListReportsForReportGroupResponse'
  { -- | The list of report ARNs.
    ListReportsForReportGroupResponse -> Maybe (NonEmpty Text)
reports :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | During a previous call, the maximum number of items that can be returned
    -- is the value specified in @maxResults@. If there more items in the list,
    -- then a unique string called a /nextToken/ is returned. 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.
    ListReportsForReportGroupResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListReportsForReportGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListReportsForReportGroupResponse
-> ListReportsForReportGroupResponse -> Bool
(ListReportsForReportGroupResponse
 -> ListReportsForReportGroupResponse -> Bool)
-> (ListReportsForReportGroupResponse
    -> ListReportsForReportGroupResponse -> Bool)
-> Eq ListReportsForReportGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportsForReportGroupResponse
-> ListReportsForReportGroupResponse -> Bool
$c/= :: ListReportsForReportGroupResponse
-> ListReportsForReportGroupResponse -> Bool
== :: ListReportsForReportGroupResponse
-> ListReportsForReportGroupResponse -> Bool
$c== :: ListReportsForReportGroupResponse
-> ListReportsForReportGroupResponse -> Bool
Prelude.Eq, ReadPrec [ListReportsForReportGroupResponse]
ReadPrec ListReportsForReportGroupResponse
Int -> ReadS ListReportsForReportGroupResponse
ReadS [ListReportsForReportGroupResponse]
(Int -> ReadS ListReportsForReportGroupResponse)
-> ReadS [ListReportsForReportGroupResponse]
-> ReadPrec ListReportsForReportGroupResponse
-> ReadPrec [ListReportsForReportGroupResponse]
-> Read ListReportsForReportGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportsForReportGroupResponse]
$creadListPrec :: ReadPrec [ListReportsForReportGroupResponse]
readPrec :: ReadPrec ListReportsForReportGroupResponse
$creadPrec :: ReadPrec ListReportsForReportGroupResponse
readList :: ReadS [ListReportsForReportGroupResponse]
$creadList :: ReadS [ListReportsForReportGroupResponse]
readsPrec :: Int -> ReadS ListReportsForReportGroupResponse
$creadsPrec :: Int -> ReadS ListReportsForReportGroupResponse
Prelude.Read, Int -> ListReportsForReportGroupResponse -> ShowS
[ListReportsForReportGroupResponse] -> ShowS
ListReportsForReportGroupResponse -> String
(Int -> ListReportsForReportGroupResponse -> ShowS)
-> (ListReportsForReportGroupResponse -> String)
-> ([ListReportsForReportGroupResponse] -> ShowS)
-> Show ListReportsForReportGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportsForReportGroupResponse] -> ShowS
$cshowList :: [ListReportsForReportGroupResponse] -> ShowS
show :: ListReportsForReportGroupResponse -> String
$cshow :: ListReportsForReportGroupResponse -> String
showsPrec :: Int -> ListReportsForReportGroupResponse -> ShowS
$cshowsPrec :: Int -> ListReportsForReportGroupResponse -> ShowS
Prelude.Show, (forall x.
 ListReportsForReportGroupResponse
 -> Rep ListReportsForReportGroupResponse x)
-> (forall x.
    Rep ListReportsForReportGroupResponse x
    -> ListReportsForReportGroupResponse)
-> Generic ListReportsForReportGroupResponse
forall x.
Rep ListReportsForReportGroupResponse x
-> ListReportsForReportGroupResponse
forall x.
ListReportsForReportGroupResponse
-> Rep ListReportsForReportGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListReportsForReportGroupResponse x
-> ListReportsForReportGroupResponse
$cfrom :: forall x.
ListReportsForReportGroupResponse
-> Rep ListReportsForReportGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListReportsForReportGroupResponse' 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:
--
-- 'reports', 'listReportsForReportGroupResponse_reports' - The list of report ARNs.
--
-- 'nextToken', 'listReportsForReportGroupResponse_nextToken' - During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
--
-- 'httpStatus', 'listReportsForReportGroupResponse_httpStatus' - The response's http status code.
newListReportsForReportGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListReportsForReportGroupResponse
newListReportsForReportGroupResponse :: Int -> ListReportsForReportGroupResponse
newListReportsForReportGroupResponse Int
pHttpStatus_ =
  ListReportsForReportGroupResponse' :: Maybe (NonEmpty Text)
-> Maybe Text -> Int -> ListReportsForReportGroupResponse
ListReportsForReportGroupResponse'
    { $sel:reports:ListReportsForReportGroupResponse' :: Maybe (NonEmpty Text)
reports =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListReportsForReportGroupResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListReportsForReportGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of report ARNs.
listReportsForReportGroupResponse_reports :: Lens.Lens' ListReportsForReportGroupResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listReportsForReportGroupResponse_reports :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListReportsForReportGroupResponse
-> f ListReportsForReportGroupResponse
listReportsForReportGroupResponse_reports = (ListReportsForReportGroupResponse -> Maybe (NonEmpty Text))
-> (ListReportsForReportGroupResponse
    -> Maybe (NonEmpty Text) -> ListReportsForReportGroupResponse)
-> Lens' ListReportsForReportGroupResponse (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportsForReportGroupResponse' {Maybe (NonEmpty Text)
reports :: Maybe (NonEmpty Text)
$sel:reports:ListReportsForReportGroupResponse' :: ListReportsForReportGroupResponse -> Maybe (NonEmpty Text)
reports} -> Maybe (NonEmpty Text)
reports) (\s :: ListReportsForReportGroupResponse
s@ListReportsForReportGroupResponse' {} Maybe (NonEmpty Text)
a -> ListReportsForReportGroupResponse
s {$sel:reports:ListReportsForReportGroupResponse' :: Maybe (NonEmpty Text)
reports = Maybe (NonEmpty Text)
a} :: ListReportsForReportGroupResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListReportsForReportGroupResponse
 -> f ListReportsForReportGroupResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListReportsForReportGroupResponse
-> f ListReportsForReportGroupResponse
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

-- | During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
listReportsForReportGroupResponse_nextToken :: Lens.Lens' ListReportsForReportGroupResponse (Prelude.Maybe Prelude.Text)
listReportsForReportGroupResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListReportsForReportGroupResponse
-> f ListReportsForReportGroupResponse
listReportsForReportGroupResponse_nextToken = (ListReportsForReportGroupResponse -> Maybe Text)
-> (ListReportsForReportGroupResponse
    -> Maybe Text -> ListReportsForReportGroupResponse)
-> Lens' ListReportsForReportGroupResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportsForReportGroupResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReportsForReportGroupResponse' :: ListReportsForReportGroupResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReportsForReportGroupResponse
s@ListReportsForReportGroupResponse' {} Maybe Text
a -> ListReportsForReportGroupResponse
s {$sel:nextToken:ListReportsForReportGroupResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListReportsForReportGroupResponse)

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

instance
  Prelude.NFData
    ListReportsForReportGroupResponse