{-# 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.IoT.ListBillingGroups
-- 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)
--
-- Lists the billing groups you have created.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListBillingGroups>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListBillingGroups
  ( -- * Creating a Request
    ListBillingGroups (..),
    newListBillingGroups,

    -- * Request Lenses
    listBillingGroups_namePrefixFilter,
    listBillingGroups_nextToken,
    listBillingGroups_maxResults,

    -- * Destructuring the Response
    ListBillingGroupsResponse (..),
    newListBillingGroupsResponse,

    -- * Response Lenses
    listBillingGroupsResponse_nextToken,
    listBillingGroupsResponse_billingGroups,
    listBillingGroupsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
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:/ 'newListBillingGroups' smart constructor.
data ListBillingGroups = ListBillingGroups'
  { -- | Limit the results to billing groups whose names have the given prefix.
    ListBillingGroups -> Maybe Text
namePrefixFilter :: Prelude.Maybe Prelude.Text,
    -- | To retrieve the next set of results, the @nextToken@ value from a
    -- previous response; otherwise __null__ to receive the first set of
    -- results.
    ListBillingGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per request.
    ListBillingGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListBillingGroups -> ListBillingGroups -> Bool
(ListBillingGroups -> ListBillingGroups -> Bool)
-> (ListBillingGroups -> ListBillingGroups -> Bool)
-> Eq ListBillingGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBillingGroups -> ListBillingGroups -> Bool
$c/= :: ListBillingGroups -> ListBillingGroups -> Bool
== :: ListBillingGroups -> ListBillingGroups -> Bool
$c== :: ListBillingGroups -> ListBillingGroups -> Bool
Prelude.Eq, ReadPrec [ListBillingGroups]
ReadPrec ListBillingGroups
Int -> ReadS ListBillingGroups
ReadS [ListBillingGroups]
(Int -> ReadS ListBillingGroups)
-> ReadS [ListBillingGroups]
-> ReadPrec ListBillingGroups
-> ReadPrec [ListBillingGroups]
-> Read ListBillingGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBillingGroups]
$creadListPrec :: ReadPrec [ListBillingGroups]
readPrec :: ReadPrec ListBillingGroups
$creadPrec :: ReadPrec ListBillingGroups
readList :: ReadS [ListBillingGroups]
$creadList :: ReadS [ListBillingGroups]
readsPrec :: Int -> ReadS ListBillingGroups
$creadsPrec :: Int -> ReadS ListBillingGroups
Prelude.Read, Int -> ListBillingGroups -> ShowS
[ListBillingGroups] -> ShowS
ListBillingGroups -> String
(Int -> ListBillingGroups -> ShowS)
-> (ListBillingGroups -> String)
-> ([ListBillingGroups] -> ShowS)
-> Show ListBillingGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBillingGroups] -> ShowS
$cshowList :: [ListBillingGroups] -> ShowS
show :: ListBillingGroups -> String
$cshow :: ListBillingGroups -> String
showsPrec :: Int -> ListBillingGroups -> ShowS
$cshowsPrec :: Int -> ListBillingGroups -> ShowS
Prelude.Show, (forall x. ListBillingGroups -> Rep ListBillingGroups x)
-> (forall x. Rep ListBillingGroups x -> ListBillingGroups)
-> Generic ListBillingGroups
forall x. Rep ListBillingGroups x -> ListBillingGroups
forall x. ListBillingGroups -> Rep ListBillingGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBillingGroups x -> ListBillingGroups
$cfrom :: forall x. ListBillingGroups -> Rep ListBillingGroups x
Prelude.Generic)

-- |
-- Create a value of 'ListBillingGroups' 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:
--
-- 'namePrefixFilter', 'listBillingGroups_namePrefixFilter' - Limit the results to billing groups whose names have the given prefix.
--
-- 'nextToken', 'listBillingGroups_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
--
-- 'maxResults', 'listBillingGroups_maxResults' - The maximum number of results to return per request.
newListBillingGroups ::
  ListBillingGroups
newListBillingGroups :: ListBillingGroups
newListBillingGroups =
  ListBillingGroups' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListBillingGroups
ListBillingGroups'
    { $sel:namePrefixFilter:ListBillingGroups' :: Maybe Text
namePrefixFilter =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBillingGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListBillingGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Limit the results to billing groups whose names have the given prefix.
listBillingGroups_namePrefixFilter :: Lens.Lens' ListBillingGroups (Prelude.Maybe Prelude.Text)
listBillingGroups_namePrefixFilter :: (Maybe Text -> f (Maybe Text))
-> ListBillingGroups -> f ListBillingGroups
listBillingGroups_namePrefixFilter = (ListBillingGroups -> Maybe Text)
-> (ListBillingGroups -> Maybe Text -> ListBillingGroups)
-> Lens
     ListBillingGroups ListBillingGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroups' {Maybe Text
namePrefixFilter :: Maybe Text
$sel:namePrefixFilter:ListBillingGroups' :: ListBillingGroups -> Maybe Text
namePrefixFilter} -> Maybe Text
namePrefixFilter) (\s :: ListBillingGroups
s@ListBillingGroups' {} Maybe Text
a -> ListBillingGroups
s {$sel:namePrefixFilter:ListBillingGroups' :: Maybe Text
namePrefixFilter = Maybe Text
a} :: ListBillingGroups)

-- | To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
listBillingGroups_nextToken :: Lens.Lens' ListBillingGroups (Prelude.Maybe Prelude.Text)
listBillingGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBillingGroups -> f ListBillingGroups
listBillingGroups_nextToken = (ListBillingGroups -> Maybe Text)
-> (ListBillingGroups -> Maybe Text -> ListBillingGroups)
-> Lens
     ListBillingGroups ListBillingGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBillingGroups' :: ListBillingGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBillingGroups
s@ListBillingGroups' {} Maybe Text
a -> ListBillingGroups
s {$sel:nextToken:ListBillingGroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListBillingGroups)

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

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

instance Prelude.NFData ListBillingGroups

instance Core.ToHeaders ListBillingGroups where
  toHeaders :: ListBillingGroups -> ResponseHeaders
toHeaders = ResponseHeaders -> ListBillingGroups -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery ListBillingGroups where
  toQuery :: ListBillingGroups -> QueryString
toQuery ListBillingGroups' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
namePrefixFilter :: Maybe Text
$sel:maxResults:ListBillingGroups' :: ListBillingGroups -> Maybe Natural
$sel:nextToken:ListBillingGroups' :: ListBillingGroups -> Maybe Text
$sel:namePrefixFilter:ListBillingGroups' :: ListBillingGroups -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"namePrefixFilter" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
namePrefixFilter,
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListBillingGroupsResponse' smart constructor.
data ListBillingGroupsResponse = ListBillingGroupsResponse'
  { -- | The token to use to get the next set of results, or __null__ if there
    -- are no additional results.
    ListBillingGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of billing groups.
    ListBillingGroupsResponse -> Maybe [GroupNameAndArn]
billingGroups :: Prelude.Maybe [GroupNameAndArn],
    -- | The response's http status code.
    ListBillingGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
(ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool)
-> (ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool)
-> Eq ListBillingGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
$c/= :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
== :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
$c== :: ListBillingGroupsResponse -> ListBillingGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListBillingGroupsResponse]
ReadPrec ListBillingGroupsResponse
Int -> ReadS ListBillingGroupsResponse
ReadS [ListBillingGroupsResponse]
(Int -> ReadS ListBillingGroupsResponse)
-> ReadS [ListBillingGroupsResponse]
-> ReadPrec ListBillingGroupsResponse
-> ReadPrec [ListBillingGroupsResponse]
-> Read ListBillingGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBillingGroupsResponse]
$creadListPrec :: ReadPrec [ListBillingGroupsResponse]
readPrec :: ReadPrec ListBillingGroupsResponse
$creadPrec :: ReadPrec ListBillingGroupsResponse
readList :: ReadS [ListBillingGroupsResponse]
$creadList :: ReadS [ListBillingGroupsResponse]
readsPrec :: Int -> ReadS ListBillingGroupsResponse
$creadsPrec :: Int -> ReadS ListBillingGroupsResponse
Prelude.Read, Int -> ListBillingGroupsResponse -> ShowS
[ListBillingGroupsResponse] -> ShowS
ListBillingGroupsResponse -> String
(Int -> ListBillingGroupsResponse -> ShowS)
-> (ListBillingGroupsResponse -> String)
-> ([ListBillingGroupsResponse] -> ShowS)
-> Show ListBillingGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBillingGroupsResponse] -> ShowS
$cshowList :: [ListBillingGroupsResponse] -> ShowS
show :: ListBillingGroupsResponse -> String
$cshow :: ListBillingGroupsResponse -> String
showsPrec :: Int -> ListBillingGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListBillingGroupsResponse -> ShowS
Prelude.Show, (forall x.
 ListBillingGroupsResponse -> Rep ListBillingGroupsResponse x)
-> (forall x.
    Rep ListBillingGroupsResponse x -> ListBillingGroupsResponse)
-> Generic ListBillingGroupsResponse
forall x.
Rep ListBillingGroupsResponse x -> ListBillingGroupsResponse
forall x.
ListBillingGroupsResponse -> Rep ListBillingGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListBillingGroupsResponse x -> ListBillingGroupsResponse
$cfrom :: forall x.
ListBillingGroupsResponse -> Rep ListBillingGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListBillingGroupsResponse' 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', 'listBillingGroupsResponse_nextToken' - The token to use to get the next set of results, or __null__ if there
-- are no additional results.
--
-- 'billingGroups', 'listBillingGroupsResponse_billingGroups' - The list of billing groups.
--
-- 'httpStatus', 'listBillingGroupsResponse_httpStatus' - The response's http status code.
newListBillingGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListBillingGroupsResponse
newListBillingGroupsResponse :: Int -> ListBillingGroupsResponse
newListBillingGroupsResponse Int
pHttpStatus_ =
  ListBillingGroupsResponse' :: Maybe Text
-> Maybe [GroupNameAndArn] -> Int -> ListBillingGroupsResponse
ListBillingGroupsResponse'
    { $sel:nextToken:ListBillingGroupsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:billingGroups:ListBillingGroupsResponse' :: Maybe [GroupNameAndArn]
billingGroups = Maybe [GroupNameAndArn]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListBillingGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to get the next set of results, or __null__ if there
-- are no additional results.
listBillingGroupsResponse_nextToken :: Lens.Lens' ListBillingGroupsResponse (Prelude.Maybe Prelude.Text)
listBillingGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBillingGroupsResponse -> f ListBillingGroupsResponse
listBillingGroupsResponse_nextToken = (ListBillingGroupsResponse -> Maybe Text)
-> (ListBillingGroupsResponse
    -> Maybe Text -> ListBillingGroupsResponse)
-> Lens' ListBillingGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBillingGroupsResponse
s@ListBillingGroupsResponse' {} Maybe Text
a -> ListBillingGroupsResponse
s {$sel:nextToken:ListBillingGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBillingGroupsResponse)

-- | The list of billing groups.
listBillingGroupsResponse_billingGroups :: Lens.Lens' ListBillingGroupsResponse (Prelude.Maybe [GroupNameAndArn])
listBillingGroupsResponse_billingGroups :: (Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> ListBillingGroupsResponse -> f ListBillingGroupsResponse
listBillingGroupsResponse_billingGroups = (ListBillingGroupsResponse -> Maybe [GroupNameAndArn])
-> (ListBillingGroupsResponse
    -> Maybe [GroupNameAndArn] -> ListBillingGroupsResponse)
-> Lens' ListBillingGroupsResponse (Maybe [GroupNameAndArn])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBillingGroupsResponse' {Maybe [GroupNameAndArn]
billingGroups :: Maybe [GroupNameAndArn]
$sel:billingGroups:ListBillingGroupsResponse' :: ListBillingGroupsResponse -> Maybe [GroupNameAndArn]
billingGroups} -> Maybe [GroupNameAndArn]
billingGroups) (\s :: ListBillingGroupsResponse
s@ListBillingGroupsResponse' {} Maybe [GroupNameAndArn]
a -> ListBillingGroupsResponse
s {$sel:billingGroups:ListBillingGroupsResponse' :: Maybe [GroupNameAndArn]
billingGroups = Maybe [GroupNameAndArn]
a} :: ListBillingGroupsResponse) ((Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
 -> ListBillingGroupsResponse -> f ListBillingGroupsResponse)
-> ((Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
    -> Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> (Maybe [GroupNameAndArn] -> f (Maybe [GroupNameAndArn]))
-> ListBillingGroupsResponse
-> f ListBillingGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
-> Iso
     (Maybe [GroupNameAndArn])
     (Maybe [GroupNameAndArn])
     (Maybe [GroupNameAndArn])
     (Maybe [GroupNameAndArn])
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
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
  [GroupNameAndArn]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListBillingGroupsResponse