{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- List the available lenses.
module Amazonka.WellArchitected.ListLenses
  ( -- * Creating a Request
    ListLenses (..),
    newListLenses,

    -- * Request Lenses
    listLenses_lensName,
    listLenses_lensStatus,
    listLenses_lensType,
    listLenses_maxResults,
    listLenses_nextToken,

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

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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
lensName :: Prelude.Maybe Prelude.Text,
    -- | The status of lenses to be returned.
    ListLenses -> Maybe LensStatusType
lensStatus :: Prelude.Maybe LensStatusType,
    -- | The type of lenses to be returned.
    ListLenses -> Maybe LensType
lensType :: Prelude.Maybe LensType,
    ListLenses -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    ListLenses -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListLenses -> ListLenses -> Bool
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]
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
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. 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:
--
-- 'lensName', 'listLenses_lensName' - Undocumented member.
--
-- 'lensStatus', 'listLenses_lensStatus' - The status of lenses to be returned.
--
-- 'lensType', 'listLenses_lensType' - The type of lenses to be returned.
--
-- 'maxResults', 'listLenses_maxResults' - Undocumented member.
--
-- 'nextToken', 'listLenses_nextToken' - Undocumented member.
newListLenses ::
  ListLenses
newListLenses :: ListLenses
newListLenses =
  ListLenses'
    { $sel:lensName:ListLenses' :: Maybe Text
lensName = forall a. Maybe a
Prelude.Nothing,
      $sel:lensStatus:ListLenses' :: Maybe LensStatusType
lensStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:lensType:ListLenses' :: Maybe LensType
lensType = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListLenses' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListLenses' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The status of lenses to be returned.
listLenses_lensStatus :: Lens.Lens' ListLenses (Prelude.Maybe LensStatusType)
listLenses_lensStatus :: Lens' ListLenses (Maybe LensStatusType)
listLenses_lensStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLenses' {Maybe LensStatusType
lensStatus :: Maybe LensStatusType
$sel:lensStatus:ListLenses' :: ListLenses -> Maybe LensStatusType
lensStatus} -> Maybe LensStatusType
lensStatus) (\s :: ListLenses
s@ListLenses' {} Maybe LensStatusType
a -> ListLenses
s {$sel:lensStatus:ListLenses' :: Maybe LensStatusType
lensStatus = Maybe LensStatusType
a} :: ListLenses)

-- | The type of lenses to be returned.
listLenses_lensType :: Lens.Lens' ListLenses (Prelude.Maybe LensType)
listLenses_lensType :: Lens' ListLenses (Maybe LensType)
listLenses_lensType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLenses' {Maybe LensType
lensType :: Maybe LensType
$sel:lensType:ListLenses' :: ListLenses -> Maybe LensType
lensType} -> Maybe LensType
lensType) (\s :: ListLenses
s@ListLenses' {} Maybe LensType
a -> ListLenses
s {$sel:lensType:ListLenses' :: Maybe LensType
lensType = Maybe LensType
a} :: ListLenses)

-- | Undocumented member.
listLenses_maxResults :: Lens.Lens' ListLenses (Prelude.Maybe Prelude.Natural)
listLenses_maxResults :: Lens' ListLenses (Maybe Natural)
listLenses_maxResults = 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)

-- | Undocumented member.
listLenses_nextToken :: Lens.Lens' ListLenses (Prelude.Maybe Prelude.Text)
listLenses_nextToken :: Lens' ListLenses (Maybe Text)
listLenses_nextToken = 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)

instance Core.AWSRequest ListLenses where
  type AWSResponse ListLenses = ListLensesResponse
  request :: (Service -> Service) -> ListLenses -> Request ListLenses
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListLenses
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLenses)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [LensSummary] -> Maybe Text -> Int -> ListLensesResponse
ListLensesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LensSummaries" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListLenses where
  hashWithSalt :: Int -> ListLenses -> Int
hashWithSalt Int
_salt ListLenses' {Maybe Natural
Maybe Text
Maybe LensStatusType
Maybe LensType
nextToken :: Maybe Text
maxResults :: Maybe Natural
lensType :: Maybe LensType
lensStatus :: Maybe LensStatusType
lensName :: Maybe Text
$sel:nextToken:ListLenses' :: ListLenses -> Maybe Text
$sel:maxResults:ListLenses' :: ListLenses -> Maybe Natural
$sel:lensType:ListLenses' :: ListLenses -> Maybe LensType
$sel:lensStatus:ListLenses' :: ListLenses -> Maybe LensStatusType
$sel:lensName:ListLenses' :: ListLenses -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lensName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LensStatusType
lensStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LensType
lensType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListLenses where
  rnf :: ListLenses -> ()
rnf ListLenses' {Maybe Natural
Maybe Text
Maybe LensStatusType
Maybe LensType
nextToken :: Maybe Text
maxResults :: Maybe Natural
lensType :: Maybe LensType
lensStatus :: Maybe LensStatusType
lensName :: Maybe Text
$sel:nextToken:ListLenses' :: ListLenses -> Maybe Text
$sel:maxResults:ListLenses' :: ListLenses -> Maybe Natural
$sel:lensType:ListLenses' :: ListLenses -> Maybe LensType
$sel:lensStatus:ListLenses' :: ListLenses -> Maybe LensStatusType
$sel:lensName:ListLenses' :: ListLenses -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lensName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LensStatusType
lensStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LensType
lensType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListLenses where
  toHeaders :: ListLenses -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath ListLenses where
  toPath :: ListLenses -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/lenses"

instance Data.ToQuery ListLenses where
  toQuery :: ListLenses -> QueryString
toQuery ListLenses' {Maybe Natural
Maybe Text
Maybe LensStatusType
Maybe LensType
nextToken :: Maybe Text
maxResults :: Maybe Natural
lensType :: Maybe LensType
lensStatus :: Maybe LensStatusType
lensName :: Maybe Text
$sel:nextToken:ListLenses' :: ListLenses -> Maybe Text
$sel:maxResults:ListLenses' :: ListLenses -> Maybe Natural
$sel:lensType:ListLenses' :: ListLenses -> Maybe LensType
$sel:lensStatus:ListLenses' :: ListLenses -> Maybe LensStatusType
$sel:lensName:ListLenses' :: ListLenses -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"LensName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
lensName,
        ByteString
"LensStatus" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe LensStatusType
lensStatus,
        ByteString
"LensType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe LensType
lensType,
        ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | Output of a list lenses call.
--
-- /See:/ 'newListLensesResponse' smart constructor.
data ListLensesResponse = ListLensesResponse'
  { ListLensesResponse -> Maybe [LensSummary]
lensSummaries :: Prelude.Maybe [LensSummary],
    ListLensesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListLensesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListLensesResponse -> ListLensesResponse -> Bool
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]
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
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. 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:
--
-- 'lensSummaries', 'listLensesResponse_lensSummaries' - Undocumented member.
--
-- 'nextToken', 'listLensesResponse_nextToken' - Undocumented member.
--
-- 'httpStatus', 'listLensesResponse_httpStatus' - The response's http status code.
newListLensesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListLensesResponse
newListLensesResponse :: Int -> ListLensesResponse
newListLensesResponse Int
pHttpStatus_ =
  ListLensesResponse'
    { $sel:lensSummaries:ListLensesResponse' :: Maybe [LensSummary]
lensSummaries =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListLensesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListLensesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
listLensesResponse_lensSummaries :: Lens.Lens' ListLensesResponse (Prelude.Maybe [LensSummary])
listLensesResponse_lensSummaries :: Lens' ListLensesResponse (Maybe [LensSummary])
listLensesResponse_lensSummaries = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
listLensesResponse_nextToken :: Lens.Lens' ListLensesResponse (Prelude.Maybe Prelude.Text)
listLensesResponse_nextToken :: Lens' ListLensesResponse (Maybe Text)
listLensesResponse_nextToken = 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)

-- | The response's http status code.
listLensesResponse_httpStatus :: Lens.Lens' ListLensesResponse Prelude.Int
listLensesResponse_httpStatus :: Lens' ListLensesResponse Int
listLensesResponse_httpStatus = 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 where
  rnf :: ListLensesResponse -> ()
rnf ListLensesResponse' {Int
Maybe [LensSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
lensSummaries :: Maybe [LensSummary]
$sel:httpStatus:ListLensesResponse' :: ListLensesResponse -> Int
$sel:nextToken:ListLensesResponse' :: ListLensesResponse -> Maybe Text
$sel:lensSummaries:ListLensesResponse' :: ListLensesResponse -> Maybe [LensSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [LensSummary]
lensSummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus