{-# 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.MediaConnect.ListEntitlements
-- 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)
--
-- Displays a list of all entitlements that have been granted to this
-- account. This request returns 20 results per page.
--
-- This operation returns paginated results.
module Amazonka.MediaConnect.ListEntitlements
  ( -- * Creating a Request
    ListEntitlements (..),
    newListEntitlements,

    -- * Request Lenses
    listEntitlements_nextToken,
    listEntitlements_maxResults,

    -- * Destructuring the Response
    ListEntitlementsResponse (..),
    newListEntitlementsResponse,

    -- * Response Lenses
    listEntitlementsResponse_nextToken,
    listEntitlementsResponse_entitlements,
    listEntitlementsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListEntitlements' smart constructor.
data ListEntitlements = ListEntitlements'
  { -- | The token that identifies which batch of results that you want to see.
    -- For example, you submit a ListEntitlements request with MaxResults set
    -- at 5. The service returns the first batch of results (up to 5) and a
    -- NextToken value. To see the next batch of results, you can submit the
    -- ListEntitlements request a second time and specify the NextToken value.
    ListEntitlements -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per API request. For example,
    -- you submit a ListEntitlements request with MaxResults set at 5. Although
    -- 20 items match your request, the service returns no more than the first
    -- 5 items. (The service also returns a NextToken value that you can use to
    -- fetch the next batch of results.) The service might return fewer results
    -- than the MaxResults value. If MaxResults is not included in the request,
    -- the service defaults to pagination with a maximum of 20 results per
    -- page.
    ListEntitlements -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListEntitlements -> ListEntitlements -> Bool
(ListEntitlements -> ListEntitlements -> Bool)
-> (ListEntitlements -> ListEntitlements -> Bool)
-> Eq ListEntitlements
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEntitlements -> ListEntitlements -> Bool
$c/= :: ListEntitlements -> ListEntitlements -> Bool
== :: ListEntitlements -> ListEntitlements -> Bool
$c== :: ListEntitlements -> ListEntitlements -> Bool
Prelude.Eq, ReadPrec [ListEntitlements]
ReadPrec ListEntitlements
Int -> ReadS ListEntitlements
ReadS [ListEntitlements]
(Int -> ReadS ListEntitlements)
-> ReadS [ListEntitlements]
-> ReadPrec ListEntitlements
-> ReadPrec [ListEntitlements]
-> Read ListEntitlements
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEntitlements]
$creadListPrec :: ReadPrec [ListEntitlements]
readPrec :: ReadPrec ListEntitlements
$creadPrec :: ReadPrec ListEntitlements
readList :: ReadS [ListEntitlements]
$creadList :: ReadS [ListEntitlements]
readsPrec :: Int -> ReadS ListEntitlements
$creadsPrec :: Int -> ReadS ListEntitlements
Prelude.Read, Int -> ListEntitlements -> ShowS
[ListEntitlements] -> ShowS
ListEntitlements -> String
(Int -> ListEntitlements -> ShowS)
-> (ListEntitlements -> String)
-> ([ListEntitlements] -> ShowS)
-> Show ListEntitlements
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEntitlements] -> ShowS
$cshowList :: [ListEntitlements] -> ShowS
show :: ListEntitlements -> String
$cshow :: ListEntitlements -> String
showsPrec :: Int -> ListEntitlements -> ShowS
$cshowsPrec :: Int -> ListEntitlements -> ShowS
Prelude.Show, (forall x. ListEntitlements -> Rep ListEntitlements x)
-> (forall x. Rep ListEntitlements x -> ListEntitlements)
-> Generic ListEntitlements
forall x. Rep ListEntitlements x -> ListEntitlements
forall x. ListEntitlements -> Rep ListEntitlements x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEntitlements x -> ListEntitlements
$cfrom :: forall x. ListEntitlements -> Rep ListEntitlements x
Prelude.Generic)

-- |
-- Create a value of 'ListEntitlements' 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', 'listEntitlements_nextToken' - The token that identifies which batch of results that you want to see.
-- For example, you submit a ListEntitlements request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListEntitlements request a second time and specify the NextToken value.
--
-- 'maxResults', 'listEntitlements_maxResults' - The maximum number of results to return per API request. For example,
-- you submit a ListEntitlements request with MaxResults set at 5. Although
-- 20 items match your request, the service returns no more than the first
-- 5 items. (The service also returns a NextToken value that you can use to
-- fetch the next batch of results.) The service might return fewer results
-- than the MaxResults value. If MaxResults is not included in the request,
-- the service defaults to pagination with a maximum of 20 results per
-- page.
newListEntitlements ::
  ListEntitlements
newListEntitlements :: ListEntitlements
newListEntitlements =
  ListEntitlements' :: Maybe Text -> Maybe Natural -> ListEntitlements
ListEntitlements'
    { $sel:nextToken:ListEntitlements' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListEntitlements' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The token that identifies which batch of results that you want to see.
-- For example, you submit a ListEntitlements request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListEntitlements request a second time and specify the NextToken value.
listEntitlements_nextToken :: Lens.Lens' ListEntitlements (Prelude.Maybe Prelude.Text)
listEntitlements_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEntitlements -> f ListEntitlements
listEntitlements_nextToken = (ListEntitlements -> Maybe Text)
-> (ListEntitlements -> Maybe Text -> ListEntitlements)
-> Lens ListEntitlements ListEntitlements (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitlements' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEntitlements' :: ListEntitlements -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEntitlements
s@ListEntitlements' {} Maybe Text
a -> ListEntitlements
s {$sel:nextToken:ListEntitlements' :: Maybe Text
nextToken = Maybe Text
a} :: ListEntitlements)

-- | The maximum number of results to return per API request. For example,
-- you submit a ListEntitlements request with MaxResults set at 5. Although
-- 20 items match your request, the service returns no more than the first
-- 5 items. (The service also returns a NextToken value that you can use to
-- fetch the next batch of results.) The service might return fewer results
-- than the MaxResults value. If MaxResults is not included in the request,
-- the service defaults to pagination with a maximum of 20 results per
-- page.
listEntitlements_maxResults :: Lens.Lens' ListEntitlements (Prelude.Maybe Prelude.Natural)
listEntitlements_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListEntitlements -> f ListEntitlements
listEntitlements_maxResults = (ListEntitlements -> Maybe Natural)
-> (ListEntitlements -> Maybe Natural -> ListEntitlements)
-> Lens
     ListEntitlements ListEntitlements (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitlements' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEntitlements' :: ListEntitlements -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEntitlements
s@ListEntitlements' {} Maybe Natural
a -> ListEntitlements
s {$sel:maxResults:ListEntitlements' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEntitlements)

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

instance Prelude.NFData ListEntitlements

instance Core.ToHeaders ListEntitlements where
  toHeaders :: ListEntitlements -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListEntitlements -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath ListEntitlements where
  toPath :: ListEntitlements -> ByteString
toPath = ByteString -> ListEntitlements -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/entitlements"

instance Core.ToQuery ListEntitlements where
  toQuery :: ListEntitlements -> QueryString
toQuery ListEntitlements' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListEntitlements' :: ListEntitlements -> Maybe Natural
$sel:nextToken:ListEntitlements' :: ListEntitlements -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ 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:/ 'newListEntitlementsResponse' smart constructor.
data ListEntitlementsResponse = ListEntitlementsResponse'
  { -- | The token that identifies which batch of results that you want to see.
    -- For example, you submit a ListEntitlements request with MaxResults set
    -- at 5. The service returns the first batch of results (up to 5) and a
    -- NextToken value. To see the next batch of results, you can submit the
    -- ListEntitlements request a second time and specify the NextToken value.
    ListEntitlementsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of entitlements that have been granted to you from other AWS
    -- accounts.
    ListEntitlementsResponse -> Maybe [ListedEntitlement]
entitlements :: Prelude.Maybe [ListedEntitlement],
    -- | The response's http status code.
    ListEntitlementsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListEntitlementsResponse -> ListEntitlementsResponse -> Bool
(ListEntitlementsResponse -> ListEntitlementsResponse -> Bool)
-> (ListEntitlementsResponse -> ListEntitlementsResponse -> Bool)
-> Eq ListEntitlementsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEntitlementsResponse -> ListEntitlementsResponse -> Bool
$c/= :: ListEntitlementsResponse -> ListEntitlementsResponse -> Bool
== :: ListEntitlementsResponse -> ListEntitlementsResponse -> Bool
$c== :: ListEntitlementsResponse -> ListEntitlementsResponse -> Bool
Prelude.Eq, ReadPrec [ListEntitlementsResponse]
ReadPrec ListEntitlementsResponse
Int -> ReadS ListEntitlementsResponse
ReadS [ListEntitlementsResponse]
(Int -> ReadS ListEntitlementsResponse)
-> ReadS [ListEntitlementsResponse]
-> ReadPrec ListEntitlementsResponse
-> ReadPrec [ListEntitlementsResponse]
-> Read ListEntitlementsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEntitlementsResponse]
$creadListPrec :: ReadPrec [ListEntitlementsResponse]
readPrec :: ReadPrec ListEntitlementsResponse
$creadPrec :: ReadPrec ListEntitlementsResponse
readList :: ReadS [ListEntitlementsResponse]
$creadList :: ReadS [ListEntitlementsResponse]
readsPrec :: Int -> ReadS ListEntitlementsResponse
$creadsPrec :: Int -> ReadS ListEntitlementsResponse
Prelude.Read, Int -> ListEntitlementsResponse -> ShowS
[ListEntitlementsResponse] -> ShowS
ListEntitlementsResponse -> String
(Int -> ListEntitlementsResponse -> ShowS)
-> (ListEntitlementsResponse -> String)
-> ([ListEntitlementsResponse] -> ShowS)
-> Show ListEntitlementsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEntitlementsResponse] -> ShowS
$cshowList :: [ListEntitlementsResponse] -> ShowS
show :: ListEntitlementsResponse -> String
$cshow :: ListEntitlementsResponse -> String
showsPrec :: Int -> ListEntitlementsResponse -> ShowS
$cshowsPrec :: Int -> ListEntitlementsResponse -> ShowS
Prelude.Show, (forall x.
 ListEntitlementsResponse -> Rep ListEntitlementsResponse x)
-> (forall x.
    Rep ListEntitlementsResponse x -> ListEntitlementsResponse)
-> Generic ListEntitlementsResponse
forall x.
Rep ListEntitlementsResponse x -> ListEntitlementsResponse
forall x.
ListEntitlementsResponse -> Rep ListEntitlementsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEntitlementsResponse x -> ListEntitlementsResponse
$cfrom :: forall x.
ListEntitlementsResponse -> Rep ListEntitlementsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListEntitlementsResponse' 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', 'listEntitlementsResponse_nextToken' - The token that identifies which batch of results that you want to see.
-- For example, you submit a ListEntitlements request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListEntitlements request a second time and specify the NextToken value.
--
-- 'entitlements', 'listEntitlementsResponse_entitlements' - A list of entitlements that have been granted to you from other AWS
-- accounts.
--
-- 'httpStatus', 'listEntitlementsResponse_httpStatus' - The response's http status code.
newListEntitlementsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEntitlementsResponse
newListEntitlementsResponse :: Int -> ListEntitlementsResponse
newListEntitlementsResponse Int
pHttpStatus_ =
  ListEntitlementsResponse' :: Maybe Text
-> Maybe [ListedEntitlement] -> Int -> ListEntitlementsResponse
ListEntitlementsResponse'
    { $sel:nextToken:ListEntitlementsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:entitlements:ListEntitlementsResponse' :: Maybe [ListedEntitlement]
entitlements = Maybe [ListedEntitlement]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListEntitlementsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token that identifies which batch of results that you want to see.
-- For example, you submit a ListEntitlements request with MaxResults set
-- at 5. The service returns the first batch of results (up to 5) and a
-- NextToken value. To see the next batch of results, you can submit the
-- ListEntitlements request a second time and specify the NextToken value.
listEntitlementsResponse_nextToken :: Lens.Lens' ListEntitlementsResponse (Prelude.Maybe Prelude.Text)
listEntitlementsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEntitlementsResponse -> f ListEntitlementsResponse
listEntitlementsResponse_nextToken = (ListEntitlementsResponse -> Maybe Text)
-> (ListEntitlementsResponse
    -> Maybe Text -> ListEntitlementsResponse)
-> Lens' ListEntitlementsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitlementsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEntitlementsResponse' :: ListEntitlementsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEntitlementsResponse
s@ListEntitlementsResponse' {} Maybe Text
a -> ListEntitlementsResponse
s {$sel:nextToken:ListEntitlementsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEntitlementsResponse)

-- | A list of entitlements that have been granted to you from other AWS
-- accounts.
listEntitlementsResponse_entitlements :: Lens.Lens' ListEntitlementsResponse (Prelude.Maybe [ListedEntitlement])
listEntitlementsResponse_entitlements :: (Maybe [ListedEntitlement] -> f (Maybe [ListedEntitlement]))
-> ListEntitlementsResponse -> f ListEntitlementsResponse
listEntitlementsResponse_entitlements = (ListEntitlementsResponse -> Maybe [ListedEntitlement])
-> (ListEntitlementsResponse
    -> Maybe [ListedEntitlement] -> ListEntitlementsResponse)
-> Lens' ListEntitlementsResponse (Maybe [ListedEntitlement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEntitlementsResponse' {Maybe [ListedEntitlement]
entitlements :: Maybe [ListedEntitlement]
$sel:entitlements:ListEntitlementsResponse' :: ListEntitlementsResponse -> Maybe [ListedEntitlement]
entitlements} -> Maybe [ListedEntitlement]
entitlements) (\s :: ListEntitlementsResponse
s@ListEntitlementsResponse' {} Maybe [ListedEntitlement]
a -> ListEntitlementsResponse
s {$sel:entitlements:ListEntitlementsResponse' :: Maybe [ListedEntitlement]
entitlements = Maybe [ListedEntitlement]
a} :: ListEntitlementsResponse) ((Maybe [ListedEntitlement] -> f (Maybe [ListedEntitlement]))
 -> ListEntitlementsResponse -> f ListEntitlementsResponse)
-> ((Maybe [ListedEntitlement] -> f (Maybe [ListedEntitlement]))
    -> Maybe [ListedEntitlement] -> f (Maybe [ListedEntitlement]))
-> (Maybe [ListedEntitlement] -> f (Maybe [ListedEntitlement]))
-> ListEntitlementsResponse
-> f ListEntitlementsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ListedEntitlement]
  [ListedEntitlement]
  [ListedEntitlement]
  [ListedEntitlement]
-> Iso
     (Maybe [ListedEntitlement])
     (Maybe [ListedEntitlement])
     (Maybe [ListedEntitlement])
     (Maybe [ListedEntitlement])
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
  [ListedEntitlement]
  [ListedEntitlement]
  [ListedEntitlement]
  [ListedEntitlement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListEntitlementsResponse