{-# 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.WorkSpacesWeb.ListTrustStores
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves a list of trust stores.
module Amazonka.WorkSpacesWeb.ListTrustStores
  ( -- * Creating a Request
    ListTrustStores (..),
    newListTrustStores,

    -- * Request Lenses
    listTrustStores_maxResults,
    listTrustStores_nextToken,

    -- * Destructuring the Response
    ListTrustStoresResponse (..),
    newListTrustStoresResponse,

    -- * Response Lenses
    listTrustStoresResponse_nextToken,
    listTrustStoresResponse_trustStores,
    listTrustStoresResponse_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.WorkSpacesWeb.Types

-- | /See:/ 'newListTrustStores' smart constructor.
data ListTrustStores = ListTrustStores'
  { -- | The maximum number of results to be included in the next page.
    ListTrustStores -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The pagination token used to retrieve the next page of results for this
    -- operation.
    ListTrustStores -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListTrustStores -> ListTrustStores -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTrustStores -> ListTrustStores -> Bool
$c/= :: ListTrustStores -> ListTrustStores -> Bool
== :: ListTrustStores -> ListTrustStores -> Bool
$c== :: ListTrustStores -> ListTrustStores -> Bool
Prelude.Eq, ReadPrec [ListTrustStores]
ReadPrec ListTrustStores
Int -> ReadS ListTrustStores
ReadS [ListTrustStores]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTrustStores]
$creadListPrec :: ReadPrec [ListTrustStores]
readPrec :: ReadPrec ListTrustStores
$creadPrec :: ReadPrec ListTrustStores
readList :: ReadS [ListTrustStores]
$creadList :: ReadS [ListTrustStores]
readsPrec :: Int -> ReadS ListTrustStores
$creadsPrec :: Int -> ReadS ListTrustStores
Prelude.Read, Int -> ListTrustStores -> ShowS
[ListTrustStores] -> ShowS
ListTrustStores -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTrustStores] -> ShowS
$cshowList :: [ListTrustStores] -> ShowS
show :: ListTrustStores -> String
$cshow :: ListTrustStores -> String
showsPrec :: Int -> ListTrustStores -> ShowS
$cshowsPrec :: Int -> ListTrustStores -> ShowS
Prelude.Show, forall x. Rep ListTrustStores x -> ListTrustStores
forall x. ListTrustStores -> Rep ListTrustStores x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTrustStores x -> ListTrustStores
$cfrom :: forall x. ListTrustStores -> Rep ListTrustStores x
Prelude.Generic)

-- |
-- Create a value of 'ListTrustStores' 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:
--
-- 'maxResults', 'listTrustStores_maxResults' - The maximum number of results to be included in the next page.
--
-- 'nextToken', 'listTrustStores_nextToken' - The pagination token used to retrieve the next page of results for this
-- operation.
newListTrustStores ::
  ListTrustStores
newListTrustStores :: ListTrustStores
newListTrustStores =
  ListTrustStores'
    { $sel:maxResults:ListTrustStores' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTrustStores' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of results to be included in the next page.
listTrustStores_maxResults :: Lens.Lens' ListTrustStores (Prelude.Maybe Prelude.Natural)
listTrustStores_maxResults :: Lens' ListTrustStores (Maybe Natural)
listTrustStores_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrustStores' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListTrustStores' :: ListTrustStores -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListTrustStores
s@ListTrustStores' {} Maybe Natural
a -> ListTrustStores
s {$sel:maxResults:ListTrustStores' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListTrustStores)

-- | The pagination token used to retrieve the next page of results for this
-- operation.
listTrustStores_nextToken :: Lens.Lens' ListTrustStores (Prelude.Maybe Prelude.Text)
listTrustStores_nextToken :: Lens' ListTrustStores (Maybe Text)
listTrustStores_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrustStores' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTrustStores' :: ListTrustStores -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTrustStores
s@ListTrustStores' {} Maybe Text
a -> ListTrustStores
s {$sel:nextToken:ListTrustStores' :: Maybe Text
nextToken = Maybe Text
a} :: ListTrustStores)

instance Core.AWSRequest ListTrustStores where
  type
    AWSResponse ListTrustStores =
      ListTrustStoresResponse
  request :: (Service -> Service) -> ListTrustStores -> Request ListTrustStores
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 ListTrustStores
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTrustStores)))
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 Text
-> Maybe [TrustStoreSummary] -> Int -> ListTrustStoresResponse
ListTrustStoresResponse'
            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
"nextToken")
            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
"trustStores" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListTrustStores where
  hashWithSalt :: Int -> ListTrustStores -> Int
hashWithSalt Int
_salt ListTrustStores' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListTrustStores' :: ListTrustStores -> Maybe Text
$sel:maxResults:ListTrustStores' :: ListTrustStores -> Maybe Natural
..} =
    Int
_salt
      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 ListTrustStores where
  rnf :: ListTrustStores -> ()
rnf ListTrustStores' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListTrustStores' :: ListTrustStores -> Maybe Text
$sel:maxResults:ListTrustStores' :: ListTrustStores -> Maybe Natural
..} =
    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 ListTrustStores where
  toHeaders :: ListTrustStores -> 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 ListTrustStores where
  toPath :: ListTrustStores -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/trustStores"

instance Data.ToQuery ListTrustStores where
  toQuery :: ListTrustStores -> QueryString
toQuery ListTrustStores' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListTrustStores' :: ListTrustStores -> Maybe Text
$sel:maxResults:ListTrustStores' :: ListTrustStores -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ 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
      ]

-- | /See:/ 'newListTrustStoresResponse' smart constructor.
data ListTrustStoresResponse = ListTrustStoresResponse'
  { -- | The pagination token used to retrieve the next page of results for this
    -- operation.
    ListTrustStoresResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The trust stores.
    ListTrustStoresResponse -> Maybe [TrustStoreSummary]
trustStores :: Prelude.Maybe [TrustStoreSummary],
    -- | The response's http status code.
    ListTrustStoresResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTrustStoresResponse -> ListTrustStoresResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTrustStoresResponse -> ListTrustStoresResponse -> Bool
$c/= :: ListTrustStoresResponse -> ListTrustStoresResponse -> Bool
== :: ListTrustStoresResponse -> ListTrustStoresResponse -> Bool
$c== :: ListTrustStoresResponse -> ListTrustStoresResponse -> Bool
Prelude.Eq, ReadPrec [ListTrustStoresResponse]
ReadPrec ListTrustStoresResponse
Int -> ReadS ListTrustStoresResponse
ReadS [ListTrustStoresResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTrustStoresResponse]
$creadListPrec :: ReadPrec [ListTrustStoresResponse]
readPrec :: ReadPrec ListTrustStoresResponse
$creadPrec :: ReadPrec ListTrustStoresResponse
readList :: ReadS [ListTrustStoresResponse]
$creadList :: ReadS [ListTrustStoresResponse]
readsPrec :: Int -> ReadS ListTrustStoresResponse
$creadsPrec :: Int -> ReadS ListTrustStoresResponse
Prelude.Read, Int -> ListTrustStoresResponse -> ShowS
[ListTrustStoresResponse] -> ShowS
ListTrustStoresResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTrustStoresResponse] -> ShowS
$cshowList :: [ListTrustStoresResponse] -> ShowS
show :: ListTrustStoresResponse -> String
$cshow :: ListTrustStoresResponse -> String
showsPrec :: Int -> ListTrustStoresResponse -> ShowS
$cshowsPrec :: Int -> ListTrustStoresResponse -> ShowS
Prelude.Show, forall x. Rep ListTrustStoresResponse x -> ListTrustStoresResponse
forall x. ListTrustStoresResponse -> Rep ListTrustStoresResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTrustStoresResponse x -> ListTrustStoresResponse
$cfrom :: forall x. ListTrustStoresResponse -> Rep ListTrustStoresResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListTrustStoresResponse' 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', 'listTrustStoresResponse_nextToken' - The pagination token used to retrieve the next page of results for this
-- operation.
--
-- 'trustStores', 'listTrustStoresResponse_trustStores' - The trust stores.
--
-- 'httpStatus', 'listTrustStoresResponse_httpStatus' - The response's http status code.
newListTrustStoresResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTrustStoresResponse
newListTrustStoresResponse :: Int -> ListTrustStoresResponse
newListTrustStoresResponse Int
pHttpStatus_ =
  ListTrustStoresResponse'
    { $sel:nextToken:ListTrustStoresResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:trustStores:ListTrustStoresResponse' :: Maybe [TrustStoreSummary]
trustStores = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTrustStoresResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token used to retrieve the next page of results for this
-- operation.
listTrustStoresResponse_nextToken :: Lens.Lens' ListTrustStoresResponse (Prelude.Maybe Prelude.Text)
listTrustStoresResponse_nextToken :: Lens' ListTrustStoresResponse (Maybe Text)
listTrustStoresResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrustStoresResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTrustStoresResponse' :: ListTrustStoresResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTrustStoresResponse
s@ListTrustStoresResponse' {} Maybe Text
a -> ListTrustStoresResponse
s {$sel:nextToken:ListTrustStoresResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTrustStoresResponse)

-- | The trust stores.
listTrustStoresResponse_trustStores :: Lens.Lens' ListTrustStoresResponse (Prelude.Maybe [TrustStoreSummary])
listTrustStoresResponse_trustStores :: Lens' ListTrustStoresResponse (Maybe [TrustStoreSummary])
listTrustStoresResponse_trustStores = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrustStoresResponse' {Maybe [TrustStoreSummary]
trustStores :: Maybe [TrustStoreSummary]
$sel:trustStores:ListTrustStoresResponse' :: ListTrustStoresResponse -> Maybe [TrustStoreSummary]
trustStores} -> Maybe [TrustStoreSummary]
trustStores) (\s :: ListTrustStoresResponse
s@ListTrustStoresResponse' {} Maybe [TrustStoreSummary]
a -> ListTrustStoresResponse
s {$sel:trustStores:ListTrustStoresResponse' :: Maybe [TrustStoreSummary]
trustStores = Maybe [TrustStoreSummary]
a} :: ListTrustStoresResponse) 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

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

instance Prelude.NFData ListTrustStoresResponse where
  rnf :: ListTrustStoresResponse -> ()
rnf ListTrustStoresResponse' {Int
Maybe [TrustStoreSummary]
Maybe Text
httpStatus :: Int
trustStores :: Maybe [TrustStoreSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListTrustStoresResponse' :: ListTrustStoresResponse -> Int
$sel:trustStores:ListTrustStoresResponse' :: ListTrustStoresResponse -> Maybe [TrustStoreSummary]
$sel:nextToken:ListTrustStoresResponse' :: ListTrustStoresResponse -> Maybe Text
..} =
    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 Maybe [TrustStoreSummary]
trustStores
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus