{-# 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.ListSharedReportGroups
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets a list of report groups that are shared with other Amazon Web
-- Services accounts or users.
--
-- This operation returns paginated results.
module Amazonka.CodeBuild.ListSharedReportGroups
  ( -- * Creating a Request
    ListSharedReportGroups (..),
    newListSharedReportGroups,

    -- * Request Lenses
    listSharedReportGroups_sortOrder,
    listSharedReportGroups_nextToken,
    listSharedReportGroups_maxResults,
    listSharedReportGroups_sortBy,

    -- * Destructuring the Response
    ListSharedReportGroupsResponse (..),
    newListSharedReportGroupsResponse,

    -- * Response Lenses
    listSharedReportGroupsResponse_nextToken,
    listSharedReportGroupsResponse_reportGroups,
    listSharedReportGroupsResponse_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:/ 'newListSharedReportGroups' smart constructor.
data ListSharedReportGroups = ListSharedReportGroups'
  { -- | The order in which to list shared report groups. Valid values include:
    --
    -- -   @ASCENDING@: List in ascending order.
    --
    -- -   @DESCENDING@: List in descending order.
    ListSharedReportGroups -> 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.
    ListSharedReportGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of paginated shared report groups per response. Use
    -- @nextToken@ to iterate pages in the list of returned @ReportGroup@
    -- objects. The default value is 100.
    ListSharedReportGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The criterion to be used to list report groups shared with the current
    -- Amazon Web Services account or user. Valid values include:
    --
    -- -   @ARN@: List based on the ARN.
    --
    -- -   @MODIFIED_TIME@: List based on when information about the shared
    --     report group was last changed.
    ListSharedReportGroups -> Maybe SharedResourceSortByType
sortBy :: Prelude.Maybe SharedResourceSortByType
  }
  deriving (ListSharedReportGroups -> ListSharedReportGroups -> Bool
(ListSharedReportGroups -> ListSharedReportGroups -> Bool)
-> (ListSharedReportGroups -> ListSharedReportGroups -> Bool)
-> Eq ListSharedReportGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSharedReportGroups -> ListSharedReportGroups -> Bool
$c/= :: ListSharedReportGroups -> ListSharedReportGroups -> Bool
== :: ListSharedReportGroups -> ListSharedReportGroups -> Bool
$c== :: ListSharedReportGroups -> ListSharedReportGroups -> Bool
Prelude.Eq, ReadPrec [ListSharedReportGroups]
ReadPrec ListSharedReportGroups
Int -> ReadS ListSharedReportGroups
ReadS [ListSharedReportGroups]
(Int -> ReadS ListSharedReportGroups)
-> ReadS [ListSharedReportGroups]
-> ReadPrec ListSharedReportGroups
-> ReadPrec [ListSharedReportGroups]
-> Read ListSharedReportGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSharedReportGroups]
$creadListPrec :: ReadPrec [ListSharedReportGroups]
readPrec :: ReadPrec ListSharedReportGroups
$creadPrec :: ReadPrec ListSharedReportGroups
readList :: ReadS [ListSharedReportGroups]
$creadList :: ReadS [ListSharedReportGroups]
readsPrec :: Int -> ReadS ListSharedReportGroups
$creadsPrec :: Int -> ReadS ListSharedReportGroups
Prelude.Read, Int -> ListSharedReportGroups -> ShowS
[ListSharedReportGroups] -> ShowS
ListSharedReportGroups -> String
(Int -> ListSharedReportGroups -> ShowS)
-> (ListSharedReportGroups -> String)
-> ([ListSharedReportGroups] -> ShowS)
-> Show ListSharedReportGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSharedReportGroups] -> ShowS
$cshowList :: [ListSharedReportGroups] -> ShowS
show :: ListSharedReportGroups -> String
$cshow :: ListSharedReportGroups -> String
showsPrec :: Int -> ListSharedReportGroups -> ShowS
$cshowsPrec :: Int -> ListSharedReportGroups -> ShowS
Prelude.Show, (forall x. ListSharedReportGroups -> Rep ListSharedReportGroups x)
-> (forall x.
    Rep ListSharedReportGroups x -> ListSharedReportGroups)
-> Generic ListSharedReportGroups
forall x. Rep ListSharedReportGroups x -> ListSharedReportGroups
forall x. ListSharedReportGroups -> Rep ListSharedReportGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSharedReportGroups x -> ListSharedReportGroups
$cfrom :: forall x. ListSharedReportGroups -> Rep ListSharedReportGroups x
Prelude.Generic)

-- |
-- Create a value of 'ListSharedReportGroups' 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', 'listSharedReportGroups_sortOrder' - The order in which to list shared report groups. Valid values include:
--
-- -   @ASCENDING@: List in ascending order.
--
-- -   @DESCENDING@: List in descending order.
--
-- 'nextToken', 'listSharedReportGroups_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', 'listSharedReportGroups_maxResults' - The maximum number of paginated shared report groups per response. Use
-- @nextToken@ to iterate pages in the list of returned @ReportGroup@
-- objects. The default value is 100.
--
-- 'sortBy', 'listSharedReportGroups_sortBy' - The criterion to be used to list report groups shared with the current
-- Amazon Web Services account or user. Valid values include:
--
-- -   @ARN@: List based on the ARN.
--
-- -   @MODIFIED_TIME@: List based on when information about the shared
--     report group was last changed.
newListSharedReportGroups ::
  ListSharedReportGroups
newListSharedReportGroups :: ListSharedReportGroups
newListSharedReportGroups =
  ListSharedReportGroups' :: Maybe SortOrderType
-> Maybe Text
-> Maybe Natural
-> Maybe SharedResourceSortByType
-> ListSharedReportGroups
ListSharedReportGroups'
    { $sel:sortOrder:ListSharedReportGroups' :: Maybe SortOrderType
sortOrder =
        Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListSharedReportGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListSharedReportGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListSharedReportGroups' :: Maybe SharedResourceSortByType
sortBy = Maybe SharedResourceSortByType
forall a. Maybe a
Prelude.Nothing
    }

-- | The order in which to list shared report groups. Valid values include:
--
-- -   @ASCENDING@: List in ascending order.
--
-- -   @DESCENDING@: List in descending order.
listSharedReportGroups_sortOrder :: Lens.Lens' ListSharedReportGroups (Prelude.Maybe SortOrderType)
listSharedReportGroups_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> ListSharedReportGroups -> f ListSharedReportGroups
listSharedReportGroups_sortOrder = (ListSharedReportGroups -> Maybe SortOrderType)
-> (ListSharedReportGroups
    -> Maybe SortOrderType -> ListSharedReportGroups)
-> Lens
     ListSharedReportGroups
     ListSharedReportGroups
     (Maybe SortOrderType)
     (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedReportGroups' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:ListSharedReportGroups' :: ListSharedReportGroups -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: ListSharedReportGroups
s@ListSharedReportGroups' {} Maybe SortOrderType
a -> ListSharedReportGroups
s {$sel:sortOrder:ListSharedReportGroups' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: ListSharedReportGroups)

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

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

-- | The criterion to be used to list report groups shared with the current
-- Amazon Web Services account or user. Valid values include:
--
-- -   @ARN@: List based on the ARN.
--
-- -   @MODIFIED_TIME@: List based on when information about the shared
--     report group was last changed.
listSharedReportGroups_sortBy :: Lens.Lens' ListSharedReportGroups (Prelude.Maybe SharedResourceSortByType)
listSharedReportGroups_sortBy :: (Maybe SharedResourceSortByType
 -> f (Maybe SharedResourceSortByType))
-> ListSharedReportGroups -> f ListSharedReportGroups
listSharedReportGroups_sortBy = (ListSharedReportGroups -> Maybe SharedResourceSortByType)
-> (ListSharedReportGroups
    -> Maybe SharedResourceSortByType -> ListSharedReportGroups)
-> Lens
     ListSharedReportGroups
     ListSharedReportGroups
     (Maybe SharedResourceSortByType)
     (Maybe SharedResourceSortByType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedReportGroups' {Maybe SharedResourceSortByType
sortBy :: Maybe SharedResourceSortByType
$sel:sortBy:ListSharedReportGroups' :: ListSharedReportGroups -> Maybe SharedResourceSortByType
sortBy} -> Maybe SharedResourceSortByType
sortBy) (\s :: ListSharedReportGroups
s@ListSharedReportGroups' {} Maybe SharedResourceSortByType
a -> ListSharedReportGroups
s {$sel:sortBy:ListSharedReportGroups' :: Maybe SharedResourceSortByType
sortBy = Maybe SharedResourceSortByType
a} :: ListSharedReportGroups)

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

instance Prelude.NFData ListSharedReportGroups

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

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

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

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

-- |
-- Create a value of 'ListSharedReportGroupsResponse' 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', 'listSharedReportGroupsResponse_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', 'listSharedReportGroupsResponse_reportGroups' - The list of ARNs for the report groups shared with the current Amazon
-- Web Services account or user.
--
-- 'httpStatus', 'listSharedReportGroupsResponse_httpStatus' - The response's http status code.
newListSharedReportGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSharedReportGroupsResponse
newListSharedReportGroupsResponse :: Int -> ListSharedReportGroupsResponse
newListSharedReportGroupsResponse Int
pHttpStatus_ =
  ListSharedReportGroupsResponse' :: Maybe Text
-> Maybe (NonEmpty Text) -> Int -> ListSharedReportGroupsResponse
ListSharedReportGroupsResponse'
    { $sel:nextToken:ListSharedReportGroupsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reportGroups:ListSharedReportGroupsResponse' :: Maybe (NonEmpty Text)
reportGroups = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSharedReportGroupsResponse' :: 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.
listSharedReportGroupsResponse_nextToken :: Lens.Lens' ListSharedReportGroupsResponse (Prelude.Maybe Prelude.Text)
listSharedReportGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSharedReportGroupsResponse
-> f ListSharedReportGroupsResponse
listSharedReportGroupsResponse_nextToken = (ListSharedReportGroupsResponse -> Maybe Text)
-> (ListSharedReportGroupsResponse
    -> Maybe Text -> ListSharedReportGroupsResponse)
-> Lens' ListSharedReportGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedReportGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSharedReportGroupsResponse' :: ListSharedReportGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSharedReportGroupsResponse
s@ListSharedReportGroupsResponse' {} Maybe Text
a -> ListSharedReportGroupsResponse
s {$sel:nextToken:ListSharedReportGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSharedReportGroupsResponse)

-- | The list of ARNs for the report groups shared with the current Amazon
-- Web Services account or user.
listSharedReportGroupsResponse_reportGroups :: Lens.Lens' ListSharedReportGroupsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listSharedReportGroupsResponse_reportGroups :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListSharedReportGroupsResponse
-> f ListSharedReportGroupsResponse
listSharedReportGroupsResponse_reportGroups = (ListSharedReportGroupsResponse -> Maybe (NonEmpty Text))
-> (ListSharedReportGroupsResponse
    -> Maybe (NonEmpty Text) -> ListSharedReportGroupsResponse)
-> Lens' ListSharedReportGroupsResponse (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedReportGroupsResponse' {Maybe (NonEmpty Text)
reportGroups :: Maybe (NonEmpty Text)
$sel:reportGroups:ListSharedReportGroupsResponse' :: ListSharedReportGroupsResponse -> Maybe (NonEmpty Text)
reportGroups} -> Maybe (NonEmpty Text)
reportGroups) (\s :: ListSharedReportGroupsResponse
s@ListSharedReportGroupsResponse' {} Maybe (NonEmpty Text)
a -> ListSharedReportGroupsResponse
s {$sel:reportGroups:ListSharedReportGroupsResponse' :: Maybe (NonEmpty Text)
reportGroups = Maybe (NonEmpty Text)
a} :: ListSharedReportGroupsResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListSharedReportGroupsResponse
 -> f ListSharedReportGroupsResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListSharedReportGroupsResponse
-> f ListSharedReportGroupsResponse
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.
listSharedReportGroupsResponse_httpStatus :: Lens.Lens' ListSharedReportGroupsResponse Prelude.Int
listSharedReportGroupsResponse_httpStatus :: (Int -> f Int)
-> ListSharedReportGroupsResponse
-> f ListSharedReportGroupsResponse
listSharedReportGroupsResponse_httpStatus = (ListSharedReportGroupsResponse -> Int)
-> (ListSharedReportGroupsResponse
    -> Int -> ListSharedReportGroupsResponse)
-> Lens
     ListSharedReportGroupsResponse
     ListSharedReportGroupsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedReportGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSharedReportGroupsResponse' :: ListSharedReportGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSharedReportGroupsResponse
s@ListSharedReportGroupsResponse' {} Int
a -> ListSharedReportGroupsResponse
s {$sel:httpStatus:ListSharedReportGroupsResponse' :: Int
httpStatus = Int
a} :: ListSharedReportGroupsResponse)

instance
  Prelude.NFData
    ListSharedReportGroupsResponse