{-# 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.AccessAnalyzer.ListAccessPreviews
-- 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)
--
-- Retrieves a list of access previews for the specified analyzer.
--
-- This operation returns paginated results.
module Amazonka.AccessAnalyzer.ListAccessPreviews
  ( -- * Creating a Request
    ListAccessPreviews (..),
    newListAccessPreviews,

    -- * Request Lenses
    listAccessPreviews_nextToken,
    listAccessPreviews_maxResults,
    listAccessPreviews_analyzerArn,

    -- * Destructuring the Response
    ListAccessPreviewsResponse (..),
    newListAccessPreviewsResponse,

    -- * Response Lenses
    listAccessPreviewsResponse_nextToken,
    listAccessPreviewsResponse_httpStatus,
    listAccessPreviewsResponse_accessPreviews,
  )
where

import Amazonka.AccessAnalyzer.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:/ 'newListAccessPreviews' smart constructor.
data ListAccessPreviews = ListAccessPreviews'
  { -- | A token used for pagination of results returned.
    ListAccessPreviews -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in the response.
    ListAccessPreviews -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources ARN of the analyzer>
    -- used to generate the access preview.
    ListAccessPreviews -> Text
analyzerArn :: Prelude.Text
  }
  deriving (ListAccessPreviews -> ListAccessPreviews -> Bool
(ListAccessPreviews -> ListAccessPreviews -> Bool)
-> (ListAccessPreviews -> ListAccessPreviews -> Bool)
-> Eq ListAccessPreviews
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccessPreviews -> ListAccessPreviews -> Bool
$c/= :: ListAccessPreviews -> ListAccessPreviews -> Bool
== :: ListAccessPreviews -> ListAccessPreviews -> Bool
$c== :: ListAccessPreviews -> ListAccessPreviews -> Bool
Prelude.Eq, ReadPrec [ListAccessPreviews]
ReadPrec ListAccessPreviews
Int -> ReadS ListAccessPreviews
ReadS [ListAccessPreviews]
(Int -> ReadS ListAccessPreviews)
-> ReadS [ListAccessPreviews]
-> ReadPrec ListAccessPreviews
-> ReadPrec [ListAccessPreviews]
-> Read ListAccessPreviews
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccessPreviews]
$creadListPrec :: ReadPrec [ListAccessPreviews]
readPrec :: ReadPrec ListAccessPreviews
$creadPrec :: ReadPrec ListAccessPreviews
readList :: ReadS [ListAccessPreviews]
$creadList :: ReadS [ListAccessPreviews]
readsPrec :: Int -> ReadS ListAccessPreviews
$creadsPrec :: Int -> ReadS ListAccessPreviews
Prelude.Read, Int -> ListAccessPreviews -> ShowS
[ListAccessPreviews] -> ShowS
ListAccessPreviews -> String
(Int -> ListAccessPreviews -> ShowS)
-> (ListAccessPreviews -> String)
-> ([ListAccessPreviews] -> ShowS)
-> Show ListAccessPreviews
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccessPreviews] -> ShowS
$cshowList :: [ListAccessPreviews] -> ShowS
show :: ListAccessPreviews -> String
$cshow :: ListAccessPreviews -> String
showsPrec :: Int -> ListAccessPreviews -> ShowS
$cshowsPrec :: Int -> ListAccessPreviews -> ShowS
Prelude.Show, (forall x. ListAccessPreviews -> Rep ListAccessPreviews x)
-> (forall x. Rep ListAccessPreviews x -> ListAccessPreviews)
-> Generic ListAccessPreviews
forall x. Rep ListAccessPreviews x -> ListAccessPreviews
forall x. ListAccessPreviews -> Rep ListAccessPreviews x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccessPreviews x -> ListAccessPreviews
$cfrom :: forall x. ListAccessPreviews -> Rep ListAccessPreviews x
Prelude.Generic)

-- |
-- Create a value of 'ListAccessPreviews' 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', 'listAccessPreviews_nextToken' - A token used for pagination of results returned.
--
-- 'maxResults', 'listAccessPreviews_maxResults' - The maximum number of results to return in the response.
--
-- 'analyzerArn', 'listAccessPreviews_analyzerArn' - The
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources ARN of the analyzer>
-- used to generate the access preview.
newListAccessPreviews ::
  -- | 'analyzerArn'
  Prelude.Text ->
  ListAccessPreviews
newListAccessPreviews :: Text -> ListAccessPreviews
newListAccessPreviews Text
pAnalyzerArn_ =
  ListAccessPreviews' :: Maybe Text -> Maybe Int -> Text -> ListAccessPreviews
ListAccessPreviews'
    { $sel:nextToken:ListAccessPreviews' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAccessPreviews' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:analyzerArn:ListAccessPreviews' :: Text
analyzerArn = Text
pAnalyzerArn_
    }

-- | A token used for pagination of results returned.
listAccessPreviews_nextToken :: Lens.Lens' ListAccessPreviews (Prelude.Maybe Prelude.Text)
listAccessPreviews_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccessPreviews -> f ListAccessPreviews
listAccessPreviews_nextToken = (ListAccessPreviews -> Maybe Text)
-> (ListAccessPreviews -> Maybe Text -> ListAccessPreviews)
-> Lens
     ListAccessPreviews ListAccessPreviews (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPreviews' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccessPreviews' :: ListAccessPreviews -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccessPreviews
s@ListAccessPreviews' {} Maybe Text
a -> ListAccessPreviews
s {$sel:nextToken:ListAccessPreviews' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccessPreviews)

-- | The maximum number of results to return in the response.
listAccessPreviews_maxResults :: Lens.Lens' ListAccessPreviews (Prelude.Maybe Prelude.Int)
listAccessPreviews_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListAccessPreviews -> f ListAccessPreviews
listAccessPreviews_maxResults = (ListAccessPreviews -> Maybe Int)
-> (ListAccessPreviews -> Maybe Int -> ListAccessPreviews)
-> Lens
     ListAccessPreviews ListAccessPreviews (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPreviews' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListAccessPreviews' :: ListAccessPreviews -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListAccessPreviews
s@ListAccessPreviews' {} Maybe Int
a -> ListAccessPreviews
s {$sel:maxResults:ListAccessPreviews' :: Maybe Int
maxResults = Maybe Int
a} :: ListAccessPreviews)

-- | The
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources ARN of the analyzer>
-- used to generate the access preview.
listAccessPreviews_analyzerArn :: Lens.Lens' ListAccessPreviews Prelude.Text
listAccessPreviews_analyzerArn :: (Text -> f Text) -> ListAccessPreviews -> f ListAccessPreviews
listAccessPreviews_analyzerArn = (ListAccessPreviews -> Text)
-> (ListAccessPreviews -> Text -> ListAccessPreviews)
-> Lens ListAccessPreviews ListAccessPreviews Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPreviews' {Text
analyzerArn :: Text
$sel:analyzerArn:ListAccessPreviews' :: ListAccessPreviews -> Text
analyzerArn} -> Text
analyzerArn) (\s :: ListAccessPreviews
s@ListAccessPreviews' {} Text
a -> ListAccessPreviews
s {$sel:analyzerArn:ListAccessPreviews' :: Text
analyzerArn = Text
a} :: ListAccessPreviews)

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

instance Prelude.Hashable ListAccessPreviews

instance Prelude.NFData ListAccessPreviews

instance Core.ToHeaders ListAccessPreviews where
  toHeaders :: ListAccessPreviews -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListAccessPreviews -> 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 ListAccessPreviews where
  toPath :: ListAccessPreviews -> ByteString
toPath = ByteString -> ListAccessPreviews -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/access-preview"

instance Core.ToQuery ListAccessPreviews where
  toQuery :: ListAccessPreviews -> QueryString
toQuery ListAccessPreviews' {Maybe Int
Maybe Text
Text
analyzerArn :: Text
maxResults :: Maybe Int
nextToken :: Maybe Text
$sel:analyzerArn:ListAccessPreviews' :: ListAccessPreviews -> Text
$sel:maxResults:ListAccessPreviews' :: ListAccessPreviews -> Maybe Int
$sel:nextToken:ListAccessPreviews' :: ListAccessPreviews -> 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 Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxResults,
        ByteString
"analyzerArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
analyzerArn
      ]

-- | /See:/ 'newListAccessPreviewsResponse' smart constructor.
data ListAccessPreviewsResponse = ListAccessPreviewsResponse'
  { -- | A token used for pagination of results returned.
    ListAccessPreviewsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAccessPreviewsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of access previews retrieved for the analyzer.
    ListAccessPreviewsResponse -> [AccessPreviewSummary]
accessPreviews :: [AccessPreviewSummary]
  }
  deriving (ListAccessPreviewsResponse -> ListAccessPreviewsResponse -> Bool
(ListAccessPreviewsResponse -> ListAccessPreviewsResponse -> Bool)
-> (ListAccessPreviewsResponse
    -> ListAccessPreviewsResponse -> Bool)
-> Eq ListAccessPreviewsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccessPreviewsResponse -> ListAccessPreviewsResponse -> Bool
$c/= :: ListAccessPreviewsResponse -> ListAccessPreviewsResponse -> Bool
== :: ListAccessPreviewsResponse -> ListAccessPreviewsResponse -> Bool
$c== :: ListAccessPreviewsResponse -> ListAccessPreviewsResponse -> Bool
Prelude.Eq, ReadPrec [ListAccessPreviewsResponse]
ReadPrec ListAccessPreviewsResponse
Int -> ReadS ListAccessPreviewsResponse
ReadS [ListAccessPreviewsResponse]
(Int -> ReadS ListAccessPreviewsResponse)
-> ReadS [ListAccessPreviewsResponse]
-> ReadPrec ListAccessPreviewsResponse
-> ReadPrec [ListAccessPreviewsResponse]
-> Read ListAccessPreviewsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccessPreviewsResponse]
$creadListPrec :: ReadPrec [ListAccessPreviewsResponse]
readPrec :: ReadPrec ListAccessPreviewsResponse
$creadPrec :: ReadPrec ListAccessPreviewsResponse
readList :: ReadS [ListAccessPreviewsResponse]
$creadList :: ReadS [ListAccessPreviewsResponse]
readsPrec :: Int -> ReadS ListAccessPreviewsResponse
$creadsPrec :: Int -> ReadS ListAccessPreviewsResponse
Prelude.Read, Int -> ListAccessPreviewsResponse -> ShowS
[ListAccessPreviewsResponse] -> ShowS
ListAccessPreviewsResponse -> String
(Int -> ListAccessPreviewsResponse -> ShowS)
-> (ListAccessPreviewsResponse -> String)
-> ([ListAccessPreviewsResponse] -> ShowS)
-> Show ListAccessPreviewsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccessPreviewsResponse] -> ShowS
$cshowList :: [ListAccessPreviewsResponse] -> ShowS
show :: ListAccessPreviewsResponse -> String
$cshow :: ListAccessPreviewsResponse -> String
showsPrec :: Int -> ListAccessPreviewsResponse -> ShowS
$cshowsPrec :: Int -> ListAccessPreviewsResponse -> ShowS
Prelude.Show, (forall x.
 ListAccessPreviewsResponse -> Rep ListAccessPreviewsResponse x)
-> (forall x.
    Rep ListAccessPreviewsResponse x -> ListAccessPreviewsResponse)
-> Generic ListAccessPreviewsResponse
forall x.
Rep ListAccessPreviewsResponse x -> ListAccessPreviewsResponse
forall x.
ListAccessPreviewsResponse -> Rep ListAccessPreviewsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccessPreviewsResponse x -> ListAccessPreviewsResponse
$cfrom :: forall x.
ListAccessPreviewsResponse -> Rep ListAccessPreviewsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAccessPreviewsResponse' 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', 'listAccessPreviewsResponse_nextToken' - A token used for pagination of results returned.
--
-- 'httpStatus', 'listAccessPreviewsResponse_httpStatus' - The response's http status code.
--
-- 'accessPreviews', 'listAccessPreviewsResponse_accessPreviews' - A list of access previews retrieved for the analyzer.
newListAccessPreviewsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccessPreviewsResponse
newListAccessPreviewsResponse :: Int -> ListAccessPreviewsResponse
newListAccessPreviewsResponse Int
pHttpStatus_ =
  ListAccessPreviewsResponse' :: Maybe Text
-> Int -> [AccessPreviewSummary] -> ListAccessPreviewsResponse
ListAccessPreviewsResponse'
    { $sel:nextToken:ListAccessPreviewsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAccessPreviewsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:accessPreviews:ListAccessPreviewsResponse' :: [AccessPreviewSummary]
accessPreviews = [AccessPreviewSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token used for pagination of results returned.
listAccessPreviewsResponse_nextToken :: Lens.Lens' ListAccessPreviewsResponse (Prelude.Maybe Prelude.Text)
listAccessPreviewsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccessPreviewsResponse -> f ListAccessPreviewsResponse
listAccessPreviewsResponse_nextToken = (ListAccessPreviewsResponse -> Maybe Text)
-> (ListAccessPreviewsResponse
    -> Maybe Text -> ListAccessPreviewsResponse)
-> Lens' ListAccessPreviewsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPreviewsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccessPreviewsResponse' :: ListAccessPreviewsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccessPreviewsResponse
s@ListAccessPreviewsResponse' {} Maybe Text
a -> ListAccessPreviewsResponse
s {$sel:nextToken:ListAccessPreviewsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccessPreviewsResponse)

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

-- | A list of access previews retrieved for the analyzer.
listAccessPreviewsResponse_accessPreviews :: Lens.Lens' ListAccessPreviewsResponse [AccessPreviewSummary]
listAccessPreviewsResponse_accessPreviews :: ([AccessPreviewSummary] -> f [AccessPreviewSummary])
-> ListAccessPreviewsResponse -> f ListAccessPreviewsResponse
listAccessPreviewsResponse_accessPreviews = (ListAccessPreviewsResponse -> [AccessPreviewSummary])
-> (ListAccessPreviewsResponse
    -> [AccessPreviewSummary] -> ListAccessPreviewsResponse)
-> Lens' ListAccessPreviewsResponse [AccessPreviewSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPreviewsResponse' {[AccessPreviewSummary]
accessPreviews :: [AccessPreviewSummary]
$sel:accessPreviews:ListAccessPreviewsResponse' :: ListAccessPreviewsResponse -> [AccessPreviewSummary]
accessPreviews} -> [AccessPreviewSummary]
accessPreviews) (\s :: ListAccessPreviewsResponse
s@ListAccessPreviewsResponse' {} [AccessPreviewSummary]
a -> ListAccessPreviewsResponse
s {$sel:accessPreviews:ListAccessPreviewsResponse' :: [AccessPreviewSummary]
accessPreviews = [AccessPreviewSummary]
a} :: ListAccessPreviewsResponse) (([AccessPreviewSummary] -> f [AccessPreviewSummary])
 -> ListAccessPreviewsResponse -> f ListAccessPreviewsResponse)
-> (([AccessPreviewSummary] -> f [AccessPreviewSummary])
    -> [AccessPreviewSummary] -> f [AccessPreviewSummary])
-> ([AccessPreviewSummary] -> f [AccessPreviewSummary])
-> ListAccessPreviewsResponse
-> f ListAccessPreviewsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AccessPreviewSummary] -> f [AccessPreviewSummary])
-> [AccessPreviewSummary] -> f [AccessPreviewSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListAccessPreviewsResponse