{-# 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.WellArchitected.ListLenses
-- 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)
--
-- List the available lenses.
module Amazonka.WellArchitected.ListLenses
  ( -- * Creating a Request
    ListLenses (..),
    newListLenses,

    -- * Request Lenses
    listLenses_nextToken,
    listLenses_maxResults,

    -- * Destructuring the Response
    ListLensesResponse (..),
    newListLensesResponse,

    -- * Response Lenses
    listLensesResponse_nextToken,
    listLensesResponse_lensSummaries,
    listLensesResponse_httpStatus,
  )
where

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
import Amazonka.WellArchitected.Types

-- | Input to list lenses.
--
-- /See:/ 'newListLenses' smart constructor.
data ListLenses = ListLenses'
  { ListLenses -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    ListLenses -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListLenses -> ListLenses -> Bool
(ListLenses -> ListLenses -> Bool)
-> (ListLenses -> ListLenses -> Bool) -> Eq ListLenses
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLenses -> ListLenses -> Bool
$c/= :: ListLenses -> ListLenses -> Bool
== :: ListLenses -> ListLenses -> Bool
$c== :: ListLenses -> ListLenses -> Bool
Prelude.Eq, ReadPrec [ListLenses]
ReadPrec ListLenses
Int -> ReadS ListLenses
ReadS [ListLenses]
(Int -> ReadS ListLenses)
-> ReadS [ListLenses]
-> ReadPrec ListLenses
-> ReadPrec [ListLenses]
-> Read ListLenses
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLenses]
$creadListPrec :: ReadPrec [ListLenses]
readPrec :: ReadPrec ListLenses
$creadPrec :: ReadPrec ListLenses
readList :: ReadS [ListLenses]
$creadList :: ReadS [ListLenses]
readsPrec :: Int -> ReadS ListLenses
$creadsPrec :: Int -> ReadS ListLenses
Prelude.Read, Int -> ListLenses -> ShowS
[ListLenses] -> ShowS
ListLenses -> String
(Int -> ListLenses -> ShowS)
-> (ListLenses -> String)
-> ([ListLenses] -> ShowS)
-> Show ListLenses
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLenses] -> ShowS
$cshowList :: [ListLenses] -> ShowS
show :: ListLenses -> String
$cshow :: ListLenses -> String
showsPrec :: Int -> ListLenses -> ShowS
$cshowsPrec :: Int -> ListLenses -> ShowS
Prelude.Show, (forall x. ListLenses -> Rep ListLenses x)
-> (forall x. Rep ListLenses x -> ListLenses) -> Generic ListLenses
forall x. Rep ListLenses x -> ListLenses
forall x. ListLenses -> Rep ListLenses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLenses x -> ListLenses
$cfrom :: forall x. ListLenses -> Rep ListLenses x
Prelude.Generic)

-- |
-- Create a value of 'ListLenses' 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', 'listLenses_nextToken' - Undocumented member.
--
-- 'maxResults', 'listLenses_maxResults' - Undocumented member.
newListLenses ::
  ListLenses
newListLenses :: ListLenses
newListLenses =
  ListLenses' :: Maybe Text -> Maybe Natural -> ListLenses
ListLenses'
    { $sel:nextToken:ListLenses' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListLenses' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
listLenses_nextToken :: Lens.Lens' ListLenses (Prelude.Maybe Prelude.Text)
listLenses_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListLenses -> f ListLenses
listLenses_nextToken = (ListLenses -> Maybe Text)
-> (ListLenses -> Maybe Text -> ListLenses)
-> Lens ListLenses ListLenses (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLenses' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLenses' :: ListLenses -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLenses
s@ListLenses' {} Maybe Text
a -> ListLenses
s {$sel:nextToken:ListLenses' :: Maybe Text
nextToken = Maybe Text
a} :: ListLenses)

-- | Undocumented member.
listLenses_maxResults :: Lens.Lens' ListLenses (Prelude.Maybe Prelude.Natural)
listLenses_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListLenses -> f ListLenses
listLenses_maxResults = (ListLenses -> Maybe Natural)
-> (ListLenses -> Maybe Natural -> ListLenses)
-> Lens ListLenses ListLenses (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLenses' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListLenses' :: ListLenses -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListLenses
s@ListLenses' {} Maybe Natural
a -> ListLenses
s {$sel:maxResults:ListLenses' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListLenses)

instance Core.AWSRequest ListLenses where
  type AWSResponse ListLenses = ListLensesResponse
  request :: ListLenses -> Request ListLenses
request = Service -> ListLenses -> Request ListLenses
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListLenses
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLenses)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListLenses))
-> Logger
-> Service
-> Proxy ListLenses
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLenses)))
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 [LensSummary] -> Int -> ListLensesResponse
ListLensesResponse'
            (Maybe Text -> Maybe [LensSummary] -> Int -> ListLensesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [LensSummary] -> Int -> ListLensesResponse)
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 [LensSummary] -> Int -> ListLensesResponse)
-> Either String (Maybe [LensSummary])
-> Either String (Int -> ListLensesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [LensSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LensSummaries" Either String (Maybe (Maybe [LensSummary]))
-> Maybe [LensSummary] -> Either String (Maybe [LensSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [LensSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListLensesResponse)
-> Either String Int -> Either String ListLensesResponse
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 ListLenses

instance Prelude.NFData ListLenses

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

instance Core.ToQuery ListLenses where
  toQuery :: ListLenses -> QueryString
toQuery ListLenses' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListLenses' :: ListLenses -> Maybe Natural
$sel:nextToken:ListLenses' :: ListLenses -> 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
      ]

-- | Output of a list lenses call.
--
-- /See:/ 'newListLensesResponse' smart constructor.
data ListLensesResponse = ListLensesResponse'
  { ListLensesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    ListLensesResponse -> Maybe [LensSummary]
lensSummaries :: Prelude.Maybe [LensSummary],
    -- | The response's http status code.
    ListLensesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListLensesResponse -> ListLensesResponse -> Bool
(ListLensesResponse -> ListLensesResponse -> Bool)
-> (ListLensesResponse -> ListLensesResponse -> Bool)
-> Eq ListLensesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLensesResponse -> ListLensesResponse -> Bool
$c/= :: ListLensesResponse -> ListLensesResponse -> Bool
== :: ListLensesResponse -> ListLensesResponse -> Bool
$c== :: ListLensesResponse -> ListLensesResponse -> Bool
Prelude.Eq, ReadPrec [ListLensesResponse]
ReadPrec ListLensesResponse
Int -> ReadS ListLensesResponse
ReadS [ListLensesResponse]
(Int -> ReadS ListLensesResponse)
-> ReadS [ListLensesResponse]
-> ReadPrec ListLensesResponse
-> ReadPrec [ListLensesResponse]
-> Read ListLensesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLensesResponse]
$creadListPrec :: ReadPrec [ListLensesResponse]
readPrec :: ReadPrec ListLensesResponse
$creadPrec :: ReadPrec ListLensesResponse
readList :: ReadS [ListLensesResponse]
$creadList :: ReadS [ListLensesResponse]
readsPrec :: Int -> ReadS ListLensesResponse
$creadsPrec :: Int -> ReadS ListLensesResponse
Prelude.Read, Int -> ListLensesResponse -> ShowS
[ListLensesResponse] -> ShowS
ListLensesResponse -> String
(Int -> ListLensesResponse -> ShowS)
-> (ListLensesResponse -> String)
-> ([ListLensesResponse] -> ShowS)
-> Show ListLensesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLensesResponse] -> ShowS
$cshowList :: [ListLensesResponse] -> ShowS
show :: ListLensesResponse -> String
$cshow :: ListLensesResponse -> String
showsPrec :: Int -> ListLensesResponse -> ShowS
$cshowsPrec :: Int -> ListLensesResponse -> ShowS
Prelude.Show, (forall x. ListLensesResponse -> Rep ListLensesResponse x)
-> (forall x. Rep ListLensesResponse x -> ListLensesResponse)
-> Generic ListLensesResponse
forall x. Rep ListLensesResponse x -> ListLensesResponse
forall x. ListLensesResponse -> Rep ListLensesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLensesResponse x -> ListLensesResponse
$cfrom :: forall x. ListLensesResponse -> Rep ListLensesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListLensesResponse' 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', 'listLensesResponse_nextToken' - Undocumented member.
--
-- 'lensSummaries', 'listLensesResponse_lensSummaries' - Undocumented member.
--
-- 'httpStatus', 'listLensesResponse_httpStatus' - The response's http status code.
newListLensesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListLensesResponse
newListLensesResponse :: Int -> ListLensesResponse
newListLensesResponse Int
pHttpStatus_ =
  ListLensesResponse' :: Maybe Text -> Maybe [LensSummary] -> Int -> ListLensesResponse
ListLensesResponse'
    { $sel:nextToken:ListLensesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lensSummaries:ListLensesResponse' :: Maybe [LensSummary]
lensSummaries = Maybe [LensSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListLensesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
listLensesResponse_nextToken :: Lens.Lens' ListLensesResponse (Prelude.Maybe Prelude.Text)
listLensesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListLensesResponse -> f ListLensesResponse
listLensesResponse_nextToken = (ListLensesResponse -> Maybe Text)
-> (ListLensesResponse -> Maybe Text -> ListLensesResponse)
-> Lens
     ListLensesResponse ListLensesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLensesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLensesResponse' :: ListLensesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLensesResponse
s@ListLensesResponse' {} Maybe Text
a -> ListLensesResponse
s {$sel:nextToken:ListLensesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListLensesResponse)

-- | Undocumented member.
listLensesResponse_lensSummaries :: Lens.Lens' ListLensesResponse (Prelude.Maybe [LensSummary])
listLensesResponse_lensSummaries :: (Maybe [LensSummary] -> f (Maybe [LensSummary]))
-> ListLensesResponse -> f ListLensesResponse
listLensesResponse_lensSummaries = (ListLensesResponse -> Maybe [LensSummary])
-> (ListLensesResponse
    -> Maybe [LensSummary] -> ListLensesResponse)
-> Lens
     ListLensesResponse
     ListLensesResponse
     (Maybe [LensSummary])
     (Maybe [LensSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLensesResponse' {Maybe [LensSummary]
lensSummaries :: Maybe [LensSummary]
$sel:lensSummaries:ListLensesResponse' :: ListLensesResponse -> Maybe [LensSummary]
lensSummaries} -> Maybe [LensSummary]
lensSummaries) (\s :: ListLensesResponse
s@ListLensesResponse' {} Maybe [LensSummary]
a -> ListLensesResponse
s {$sel:lensSummaries:ListLensesResponse' :: Maybe [LensSummary]
lensSummaries = Maybe [LensSummary]
a} :: ListLensesResponse) ((Maybe [LensSummary] -> f (Maybe [LensSummary]))
 -> ListLensesResponse -> f ListLensesResponse)
-> ((Maybe [LensSummary] -> f (Maybe [LensSummary]))
    -> Maybe [LensSummary] -> f (Maybe [LensSummary]))
-> (Maybe [LensSummary] -> f (Maybe [LensSummary]))
-> ListLensesResponse
-> f ListLensesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [LensSummary] [LensSummary] [LensSummary] [LensSummary]
-> Iso
     (Maybe [LensSummary])
     (Maybe [LensSummary])
     (Maybe [LensSummary])
     (Maybe [LensSummary])
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 [LensSummary] [LensSummary] [LensSummary] [LensSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListLensesResponse