{-# 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.ListBrowserSettings
-- 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 browser settings.
module Amazonka.WorkSpacesWeb.ListBrowserSettings
  ( -- * Creating a Request
    ListBrowserSettings (..),
    newListBrowserSettings,

    -- * Request Lenses
    listBrowserSettings_maxResults,
    listBrowserSettings_nextToken,

    -- * Destructuring the Response
    ListBrowserSettingsResponse (..),
    newListBrowserSettingsResponse,

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

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

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

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

instance Core.AWSRequest ListBrowserSettings where
  type
    AWSResponse ListBrowserSettings =
      ListBrowserSettingsResponse
  request :: (Service -> Service)
-> ListBrowserSettings -> Request ListBrowserSettings
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 ListBrowserSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListBrowserSettings)))
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 [BrowserSettingsSummary]
-> Maybe Text -> Int -> ListBrowserSettingsResponse
ListBrowserSettingsResponse'
            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
"browserSettings"
                            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 ListBrowserSettings where
  hashWithSalt :: Int -> ListBrowserSettings -> Int
hashWithSalt Int
_salt ListBrowserSettings' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListBrowserSettings' :: ListBrowserSettings -> Maybe Text
$sel:maxResults:ListBrowserSettings' :: ListBrowserSettings -> 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 ListBrowserSettings where
  rnf :: ListBrowserSettings -> ()
rnf ListBrowserSettings' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListBrowserSettings' :: ListBrowserSettings -> Maybe Text
$sel:maxResults:ListBrowserSettings' :: ListBrowserSettings -> 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 ListBrowserSettings where
  toHeaders :: ListBrowserSettings -> 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 ListBrowserSettings where
  toPath :: ListBrowserSettings -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/browserSettings"

instance Data.ToQuery ListBrowserSettings where
  toQuery :: ListBrowserSettings -> QueryString
toQuery ListBrowserSettings' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListBrowserSettings' :: ListBrowserSettings -> Maybe Text
$sel:maxResults:ListBrowserSettings' :: ListBrowserSettings -> 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:/ 'newListBrowserSettingsResponse' smart constructor.
data ListBrowserSettingsResponse = ListBrowserSettingsResponse'
  { -- | The browser settings.
    ListBrowserSettingsResponse -> Maybe [BrowserSettingsSummary]
browserSettings :: Prelude.Maybe [BrowserSettingsSummary],
    -- | The pagination token used to retrieve the next page of results for this
    -- operation.
    ListBrowserSettingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListBrowserSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListBrowserSettingsResponse -> ListBrowserSettingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBrowserSettingsResponse -> ListBrowserSettingsResponse -> Bool
$c/= :: ListBrowserSettingsResponse -> ListBrowserSettingsResponse -> Bool
== :: ListBrowserSettingsResponse -> ListBrowserSettingsResponse -> Bool
$c== :: ListBrowserSettingsResponse -> ListBrowserSettingsResponse -> Bool
Prelude.Eq, ReadPrec [ListBrowserSettingsResponse]
ReadPrec ListBrowserSettingsResponse
Int -> ReadS ListBrowserSettingsResponse
ReadS [ListBrowserSettingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBrowserSettingsResponse]
$creadListPrec :: ReadPrec [ListBrowserSettingsResponse]
readPrec :: ReadPrec ListBrowserSettingsResponse
$creadPrec :: ReadPrec ListBrowserSettingsResponse
readList :: ReadS [ListBrowserSettingsResponse]
$creadList :: ReadS [ListBrowserSettingsResponse]
readsPrec :: Int -> ReadS ListBrowserSettingsResponse
$creadsPrec :: Int -> ReadS ListBrowserSettingsResponse
Prelude.Read, Int -> ListBrowserSettingsResponse -> ShowS
[ListBrowserSettingsResponse] -> ShowS
ListBrowserSettingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBrowserSettingsResponse] -> ShowS
$cshowList :: [ListBrowserSettingsResponse] -> ShowS
show :: ListBrowserSettingsResponse -> String
$cshow :: ListBrowserSettingsResponse -> String
showsPrec :: Int -> ListBrowserSettingsResponse -> ShowS
$cshowsPrec :: Int -> ListBrowserSettingsResponse -> ShowS
Prelude.Show, forall x.
Rep ListBrowserSettingsResponse x -> ListBrowserSettingsResponse
forall x.
ListBrowserSettingsResponse -> Rep ListBrowserSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListBrowserSettingsResponse x -> ListBrowserSettingsResponse
$cfrom :: forall x.
ListBrowserSettingsResponse -> Rep ListBrowserSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListBrowserSettingsResponse' 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:
--
-- 'browserSettings', 'listBrowserSettingsResponse_browserSettings' - The browser settings.
--
-- 'nextToken', 'listBrowserSettingsResponse_nextToken' - The pagination token used to retrieve the next page of results for this
-- operation.
--
-- 'httpStatus', 'listBrowserSettingsResponse_httpStatus' - The response's http status code.
newListBrowserSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListBrowserSettingsResponse
newListBrowserSettingsResponse :: Int -> ListBrowserSettingsResponse
newListBrowserSettingsResponse Int
pHttpStatus_ =
  ListBrowserSettingsResponse'
    { $sel:browserSettings:ListBrowserSettingsResponse' :: Maybe [BrowserSettingsSummary]
browserSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBrowserSettingsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListBrowserSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The browser settings.
listBrowserSettingsResponse_browserSettings :: Lens.Lens' ListBrowserSettingsResponse (Prelude.Maybe [BrowserSettingsSummary])
listBrowserSettingsResponse_browserSettings :: Lens' ListBrowserSettingsResponse (Maybe [BrowserSettingsSummary])
listBrowserSettingsResponse_browserSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBrowserSettingsResponse' {Maybe [BrowserSettingsSummary]
browserSettings :: Maybe [BrowserSettingsSummary]
$sel:browserSettings:ListBrowserSettingsResponse' :: ListBrowserSettingsResponse -> Maybe [BrowserSettingsSummary]
browserSettings} -> Maybe [BrowserSettingsSummary]
browserSettings) (\s :: ListBrowserSettingsResponse
s@ListBrowserSettingsResponse' {} Maybe [BrowserSettingsSummary]
a -> ListBrowserSettingsResponse
s {$sel:browserSettings:ListBrowserSettingsResponse' :: Maybe [BrowserSettingsSummary]
browserSettings = Maybe [BrowserSettingsSummary]
a} :: ListBrowserSettingsResponse) 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 pagination token used to retrieve the next page of results for this
-- operation.
listBrowserSettingsResponse_nextToken :: Lens.Lens' ListBrowserSettingsResponse (Prelude.Maybe Prelude.Text)
listBrowserSettingsResponse_nextToken :: Lens' ListBrowserSettingsResponse (Maybe Text)
listBrowserSettingsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBrowserSettingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBrowserSettingsResponse' :: ListBrowserSettingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBrowserSettingsResponse
s@ListBrowserSettingsResponse' {} Maybe Text
a -> ListBrowserSettingsResponse
s {$sel:nextToken:ListBrowserSettingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBrowserSettingsResponse)

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

instance Prelude.NFData ListBrowserSettingsResponse where
  rnf :: ListBrowserSettingsResponse -> ()
rnf ListBrowserSettingsResponse' {Int
Maybe [BrowserSettingsSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
browserSettings :: Maybe [BrowserSettingsSummary]
$sel:httpStatus:ListBrowserSettingsResponse' :: ListBrowserSettingsResponse -> Int
$sel:nextToken:ListBrowserSettingsResponse' :: ListBrowserSettingsResponse -> Maybe Text
$sel:browserSettings:ListBrowserSettingsResponse' :: ListBrowserSettingsResponse -> Maybe [BrowserSettingsSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [BrowserSettingsSummary]
browserSettings
      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