{-# 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.ListNetworkSettings
-- 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 network settings.
module Amazonka.WorkSpacesWeb.ListNetworkSettings
  ( -- * Creating a Request
    ListNetworkSettings (..),
    newListNetworkSettings,

    -- * Request Lenses
    listNetworkSettings_maxResults,
    listNetworkSettings_nextToken,

    -- * Destructuring the Response
    ListNetworkSettingsResponse (..),
    newListNetworkSettingsResponse,

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

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

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

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

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

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

-- |
-- Create a value of 'ListNetworkSettingsResponse' 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:
--
-- 'networkSettings', 'listNetworkSettingsResponse_networkSettings' - The network settings.
--
-- 'nextToken', 'listNetworkSettingsResponse_nextToken' - The pagination token used to retrieve the next page of results for this
-- operation.
--
-- 'httpStatus', 'listNetworkSettingsResponse_httpStatus' - The response's http status code.
newListNetworkSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListNetworkSettingsResponse
newListNetworkSettingsResponse :: Int -> ListNetworkSettingsResponse
newListNetworkSettingsResponse Int
pHttpStatus_ =
  ListNetworkSettingsResponse'
    { $sel:networkSettings:ListNetworkSettingsResponse' :: Maybe [NetworkSettingsSummary]
networkSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListNetworkSettingsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListNetworkSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The network settings.
listNetworkSettingsResponse_networkSettings :: Lens.Lens' ListNetworkSettingsResponse (Prelude.Maybe [NetworkSettingsSummary])
listNetworkSettingsResponse_networkSettings :: Lens' ListNetworkSettingsResponse (Maybe [NetworkSettingsSummary])
listNetworkSettingsResponse_networkSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworkSettingsResponse' {Maybe [NetworkSettingsSummary]
networkSettings :: Maybe [NetworkSettingsSummary]
$sel:networkSettings:ListNetworkSettingsResponse' :: ListNetworkSettingsResponse -> Maybe [NetworkSettingsSummary]
networkSettings} -> Maybe [NetworkSettingsSummary]
networkSettings) (\s :: ListNetworkSettingsResponse
s@ListNetworkSettingsResponse' {} Maybe [NetworkSettingsSummary]
a -> ListNetworkSettingsResponse
s {$sel:networkSettings:ListNetworkSettingsResponse' :: Maybe [NetworkSettingsSummary]
networkSettings = Maybe [NetworkSettingsSummary]
a} :: ListNetworkSettingsResponse) 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.
listNetworkSettingsResponse_nextToken :: Lens.Lens' ListNetworkSettingsResponse (Prelude.Maybe Prelude.Text)
listNetworkSettingsResponse_nextToken :: Lens' ListNetworkSettingsResponse (Maybe Text)
listNetworkSettingsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworkSettingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNetworkSettingsResponse' :: ListNetworkSettingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNetworkSettingsResponse
s@ListNetworkSettingsResponse' {} Maybe Text
a -> ListNetworkSettingsResponse
s {$sel:nextToken:ListNetworkSettingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListNetworkSettingsResponse)

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

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