{-# 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.ListReportGroups
-- 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 ARNs for the report groups in the current Amazon Web
-- Services account.
--
-- This operation returns paginated results.
module Amazonka.CodeBuild.ListReportGroups
  ( -- * Creating a Request
    ListReportGroups (..),
    newListReportGroups,

    -- * Request Lenses
    listReportGroups_sortOrder,
    listReportGroups_nextToken,
    listReportGroups_maxResults,
    listReportGroups_sortBy,

    -- * Destructuring the Response
    ListReportGroupsResponse (..),
    newListReportGroupsResponse,

    -- * Response Lenses
    listReportGroupsResponse_nextToken,
    listReportGroupsResponse_reportGroups,
    listReportGroupsResponse_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:/ 'newListReportGroups' smart constructor.
data ListReportGroups = ListReportGroups'
  { -- | Used to specify the order to sort the list of returned report groups.
    -- Valid values are @ASCENDING@ and @DESCENDING@.
    ListReportGroups -> 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.
    ListReportGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of paginated report groups returned per response. Use
    -- @nextToken@ to iterate pages in the list of returned @ReportGroup@
    -- objects. The default value is 100.
    ListReportGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The criterion to be used to list build report groups. Valid values
    -- include:
    --
    -- -   @CREATED_TIME@: List based on when each report group was created.
    --
    -- -   @LAST_MODIFIED_TIME@: List based on when each report group was last
    --     changed.
    --
    -- -   @NAME@: List based on each report group\'s name.
    ListReportGroups -> Maybe ReportGroupSortByType
sortBy :: Prelude.Maybe ReportGroupSortByType
  }
  deriving (ListReportGroups -> ListReportGroups -> Bool
(ListReportGroups -> ListReportGroups -> Bool)
-> (ListReportGroups -> ListReportGroups -> Bool)
-> Eq ListReportGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportGroups -> ListReportGroups -> Bool
$c/= :: ListReportGroups -> ListReportGroups -> Bool
== :: ListReportGroups -> ListReportGroups -> Bool
$c== :: ListReportGroups -> ListReportGroups -> Bool
Prelude.Eq, ReadPrec [ListReportGroups]
ReadPrec ListReportGroups
Int -> ReadS ListReportGroups
ReadS [ListReportGroups]
(Int -> ReadS ListReportGroups)
-> ReadS [ListReportGroups]
-> ReadPrec ListReportGroups
-> ReadPrec [ListReportGroups]
-> Read ListReportGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportGroups]
$creadListPrec :: ReadPrec [ListReportGroups]
readPrec :: ReadPrec ListReportGroups
$creadPrec :: ReadPrec ListReportGroups
readList :: ReadS [ListReportGroups]
$creadList :: ReadS [ListReportGroups]
readsPrec :: Int -> ReadS ListReportGroups
$creadsPrec :: Int -> ReadS ListReportGroups
Prelude.Read, Int -> ListReportGroups -> ShowS
[ListReportGroups] -> ShowS
ListReportGroups -> String
(Int -> ListReportGroups -> ShowS)
-> (ListReportGroups -> String)
-> ([ListReportGroups] -> ShowS)
-> Show ListReportGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportGroups] -> ShowS
$cshowList :: [ListReportGroups] -> ShowS
show :: ListReportGroups -> String
$cshow :: ListReportGroups -> String
showsPrec :: Int -> ListReportGroups -> ShowS
$cshowsPrec :: Int -> ListReportGroups -> ShowS
Prelude.Show, (forall x. ListReportGroups -> Rep ListReportGroups x)
-> (forall x. Rep ListReportGroups x -> ListReportGroups)
-> Generic ListReportGroups
forall x. Rep ListReportGroups x -> ListReportGroups
forall x. ListReportGroups -> Rep ListReportGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListReportGroups x -> ListReportGroups
$cfrom :: forall x. ListReportGroups -> Rep ListReportGroups x
Prelude.Generic)

-- |
-- Create a value of 'ListReportGroups' 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', 'listReportGroups_sortOrder' - Used to specify the order to sort the list of returned report groups.
-- Valid values are @ASCENDING@ and @DESCENDING@.
--
-- 'nextToken', 'listReportGroups_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.
--
-- 'maxResults', 'listReportGroups_maxResults' - The maximum number of paginated report groups returned per response. Use
-- @nextToken@ to iterate pages in the list of returned @ReportGroup@
-- objects. The default value is 100.
--
-- 'sortBy', 'listReportGroups_sortBy' - The criterion to be used to list build report groups. Valid values
-- include:
--
-- -   @CREATED_TIME@: List based on when each report group was created.
--
-- -   @LAST_MODIFIED_TIME@: List based on when each report group was last
--     changed.
--
-- -   @NAME@: List based on each report group\'s name.
newListReportGroups ::
  ListReportGroups
newListReportGroups :: ListReportGroups
newListReportGroups =
  ListReportGroups' :: Maybe SortOrderType
-> Maybe Text
-> Maybe Natural
-> Maybe ReportGroupSortByType
-> ListReportGroups
ListReportGroups'
    { $sel:sortOrder:ListReportGroups' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListReportGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListReportGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListReportGroups' :: Maybe ReportGroupSortByType
sortBy = Maybe ReportGroupSortByType
forall a. Maybe a
Prelude.Nothing
    }

-- | Used to specify the order to sort the list of returned report groups.
-- Valid values are @ASCENDING@ and @DESCENDING@.
listReportGroups_sortOrder :: Lens.Lens' ListReportGroups (Prelude.Maybe SortOrderType)
listReportGroups_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> ListReportGroups -> f ListReportGroups
listReportGroups_sortOrder = (ListReportGroups -> Maybe SortOrderType)
-> (ListReportGroups -> Maybe SortOrderType -> ListReportGroups)
-> Lens
     ListReportGroups
     ListReportGroups
     (Maybe SortOrderType)
     (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportGroups' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:ListReportGroups' :: ListReportGroups -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: ListReportGroups
s@ListReportGroups' {} Maybe SortOrderType
a -> ListReportGroups
s {$sel:sortOrder:ListReportGroups' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: ListReportGroups)

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

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

-- | The criterion to be used to list build report groups. Valid values
-- include:
--
-- -   @CREATED_TIME@: List based on when each report group was created.
--
-- -   @LAST_MODIFIED_TIME@: List based on when each report group was last
--     changed.
--
-- -   @NAME@: List based on each report group\'s name.
listReportGroups_sortBy :: Lens.Lens' ListReportGroups (Prelude.Maybe ReportGroupSortByType)
listReportGroups_sortBy :: (Maybe ReportGroupSortByType -> f (Maybe ReportGroupSortByType))
-> ListReportGroups -> f ListReportGroups
listReportGroups_sortBy = (ListReportGroups -> Maybe ReportGroupSortByType)
-> (ListReportGroups
    -> Maybe ReportGroupSortByType -> ListReportGroups)
-> Lens
     ListReportGroups
     ListReportGroups
     (Maybe ReportGroupSortByType)
     (Maybe ReportGroupSortByType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportGroups' {Maybe ReportGroupSortByType
sortBy :: Maybe ReportGroupSortByType
$sel:sortBy:ListReportGroups' :: ListReportGroups -> Maybe ReportGroupSortByType
sortBy} -> Maybe ReportGroupSortByType
sortBy) (\s :: ListReportGroups
s@ListReportGroups' {} Maybe ReportGroupSortByType
a -> ListReportGroups
s {$sel:sortBy:ListReportGroups' :: Maybe ReportGroupSortByType
sortBy = Maybe ReportGroupSortByType
a} :: ListReportGroups)

instance Core.AWSPager ListReportGroups where
  page :: ListReportGroups
-> AWSResponse ListReportGroups -> Maybe ListReportGroups
page ListReportGroups
rq AWSResponse ListReportGroups
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListReportGroups
ListReportGroupsResponse
rs
            ListReportGroupsResponse
-> Getting (First Text) ListReportGroupsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListReportGroupsResponse
-> Const (First Text) ListReportGroupsResponse
Lens' ListReportGroupsResponse (Maybe Text)
listReportGroupsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListReportGroupsResponse
 -> Const (First Text) ListReportGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListReportGroupsResponse 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 ListReportGroups
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListReportGroups
ListReportGroupsResponse
rs
            ListReportGroupsResponse
-> Getting (First [Text]) ListReportGroupsResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> ListReportGroupsResponse
-> Const (First [Text]) ListReportGroupsResponse
Lens' ListReportGroupsResponse (Maybe (NonEmpty Text))
listReportGroupsResponse_reportGroups
              ((Maybe (NonEmpty Text)
  -> Const (First [Text]) (Maybe (NonEmpty Text)))
 -> ListReportGroupsResponse
 -> Const (First [Text]) ListReportGroupsResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe (NonEmpty Text)
    -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> Getting (First [Text]) ListReportGroupsResponse [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 ListReportGroups
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListReportGroups -> Maybe ListReportGroups
forall a. a -> Maybe a
Prelude.Just (ListReportGroups -> Maybe ListReportGroups)
-> ListReportGroups -> Maybe ListReportGroups
forall a b. (a -> b) -> a -> b
Prelude.$
        ListReportGroups
rq
          ListReportGroups
-> (ListReportGroups -> ListReportGroups) -> ListReportGroups
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListReportGroups -> Identity ListReportGroups
Lens ListReportGroups ListReportGroups (Maybe Text) (Maybe Text)
listReportGroups_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListReportGroups -> Identity ListReportGroups)
-> Maybe Text -> ListReportGroups -> ListReportGroups
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListReportGroups
ListReportGroupsResponse
rs
          ListReportGroupsResponse
-> Getting (First Text) ListReportGroupsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListReportGroupsResponse
-> Const (First Text) ListReportGroupsResponse
Lens' ListReportGroupsResponse (Maybe Text)
listReportGroupsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListReportGroupsResponse
 -> Const (First Text) ListReportGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListReportGroupsResponse 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 ListReportGroups where
  type
    AWSResponse ListReportGroups =
      ListReportGroupsResponse
  request :: ListReportGroups -> Request ListReportGroups
request = Service -> ListReportGroups -> Request ListReportGroups
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListReportGroups
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListReportGroups)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListReportGroups))
-> Logger
-> Service
-> Proxy ListReportGroups
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListReportGroups)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe (NonEmpty Text) -> Int -> ListReportGroupsResponse
ListReportGroupsResponse'
            (Maybe Text
 -> Maybe (NonEmpty Text) -> Int -> ListReportGroupsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe (NonEmpty Text) -> Int -> ListReportGroupsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either
  String (Maybe (NonEmpty Text) -> Int -> ListReportGroupsResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either String (Int -> ListReportGroupsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"reportGroups")
            Either String (Int -> ListReportGroupsResponse)
-> Either String Int -> Either String ListReportGroupsResponse
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 ListReportGroups

instance Prelude.NFData ListReportGroups

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

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

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

-- | /See:/ 'newListReportGroupsResponse' smart constructor.
data ListReportGroupsResponse = ListReportGroupsResponse'
  { -- | 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.
    ListReportGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of ARNs for the report groups in the current Amazon Web
    -- Services account.
    ListReportGroupsResponse -> Maybe (NonEmpty Text)
reportGroups :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The response's http status code.
    ListReportGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListReportGroupsResponse -> ListReportGroupsResponse -> Bool
(ListReportGroupsResponse -> ListReportGroupsResponse -> Bool)
-> (ListReportGroupsResponse -> ListReportGroupsResponse -> Bool)
-> Eq ListReportGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportGroupsResponse -> ListReportGroupsResponse -> Bool
$c/= :: ListReportGroupsResponse -> ListReportGroupsResponse -> Bool
== :: ListReportGroupsResponse -> ListReportGroupsResponse -> Bool
$c== :: ListReportGroupsResponse -> ListReportGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListReportGroupsResponse]
ReadPrec ListReportGroupsResponse
Int -> ReadS ListReportGroupsResponse
ReadS [ListReportGroupsResponse]
(Int -> ReadS ListReportGroupsResponse)
-> ReadS [ListReportGroupsResponse]
-> ReadPrec ListReportGroupsResponse
-> ReadPrec [ListReportGroupsResponse]
-> Read ListReportGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportGroupsResponse]
$creadListPrec :: ReadPrec [ListReportGroupsResponse]
readPrec :: ReadPrec ListReportGroupsResponse
$creadPrec :: ReadPrec ListReportGroupsResponse
readList :: ReadS [ListReportGroupsResponse]
$creadList :: ReadS [ListReportGroupsResponse]
readsPrec :: Int -> ReadS ListReportGroupsResponse
$creadsPrec :: Int -> ReadS ListReportGroupsResponse
Prelude.Read, Int -> ListReportGroupsResponse -> ShowS
[ListReportGroupsResponse] -> ShowS
ListReportGroupsResponse -> String
(Int -> ListReportGroupsResponse -> ShowS)
-> (ListReportGroupsResponse -> String)
-> ([ListReportGroupsResponse] -> ShowS)
-> Show ListReportGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportGroupsResponse] -> ShowS
$cshowList :: [ListReportGroupsResponse] -> ShowS
show :: ListReportGroupsResponse -> String
$cshow :: ListReportGroupsResponse -> String
showsPrec :: Int -> ListReportGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListReportGroupsResponse -> ShowS
Prelude.Show, (forall x.
 ListReportGroupsResponse -> Rep ListReportGroupsResponse x)
-> (forall x.
    Rep ListReportGroupsResponse x -> ListReportGroupsResponse)
-> Generic ListReportGroupsResponse
forall x.
Rep ListReportGroupsResponse x -> ListReportGroupsResponse
forall x.
ListReportGroupsResponse -> Rep ListReportGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListReportGroupsResponse x -> ListReportGroupsResponse
$cfrom :: forall x.
ListReportGroupsResponse -> Rep ListReportGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListReportGroupsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listReportGroupsResponse_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.
--
-- 'reportGroups', 'listReportGroupsResponse_reportGroups' - The list of ARNs for the report groups in the current Amazon Web
-- Services account.
--
-- 'httpStatus', 'listReportGroupsResponse_httpStatus' - The response's http status code.
newListReportGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListReportGroupsResponse
newListReportGroupsResponse :: Int -> ListReportGroupsResponse
newListReportGroupsResponse Int
pHttpStatus_ =
  ListReportGroupsResponse' :: Maybe Text
-> Maybe (NonEmpty Text) -> Int -> ListReportGroupsResponse
ListReportGroupsResponse'
    { $sel:nextToken:ListReportGroupsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reportGroups:ListReportGroupsResponse' :: Maybe (NonEmpty Text)
reportGroups = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListReportGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The list of ARNs for the report groups in the current Amazon Web
-- Services account.
listReportGroupsResponse_reportGroups :: Lens.Lens' ListReportGroupsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listReportGroupsResponse_reportGroups :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListReportGroupsResponse -> f ListReportGroupsResponse
listReportGroupsResponse_reportGroups = (ListReportGroupsResponse -> Maybe (NonEmpty Text))
-> (ListReportGroupsResponse
    -> Maybe (NonEmpty Text) -> ListReportGroupsResponse)
-> Lens' ListReportGroupsResponse (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportGroupsResponse' {Maybe (NonEmpty Text)
reportGroups :: Maybe (NonEmpty Text)
$sel:reportGroups:ListReportGroupsResponse' :: ListReportGroupsResponse -> Maybe (NonEmpty Text)
reportGroups} -> Maybe (NonEmpty Text)
reportGroups) (\s :: ListReportGroupsResponse
s@ListReportGroupsResponse' {} Maybe (NonEmpty Text)
a -> ListReportGroupsResponse
s {$sel:reportGroups:ListReportGroupsResponse' :: Maybe (NonEmpty Text)
reportGroups = Maybe (NonEmpty Text)
a} :: ListReportGroupsResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListReportGroupsResponse -> f ListReportGroupsResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListReportGroupsResponse
-> f ListReportGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListReportGroupsResponse