{-# 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.GetNetworkSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the network settings.
module Amazonka.WorkSpacesWeb.GetNetworkSettings
  ( -- * Creating a Request
    GetNetworkSettings (..),
    newGetNetworkSettings,

    -- * Request Lenses
    getNetworkSettings_networkSettingsArn,

    -- * Destructuring the Response
    GetNetworkSettingsResponse (..),
    newGetNetworkSettingsResponse,

    -- * Response Lenses
    getNetworkSettingsResponse_networkSettings,
    getNetworkSettingsResponse_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:/ 'newGetNetworkSettings' smart constructor.
data GetNetworkSettings = GetNetworkSettings'
  { -- | The ARN of the network settings.
    GetNetworkSettings -> Text
networkSettingsArn :: Prelude.Text
  }
  deriving (GetNetworkSettings -> GetNetworkSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNetworkSettings -> GetNetworkSettings -> Bool
$c/= :: GetNetworkSettings -> GetNetworkSettings -> Bool
== :: GetNetworkSettings -> GetNetworkSettings -> Bool
$c== :: GetNetworkSettings -> GetNetworkSettings -> Bool
Prelude.Eq, ReadPrec [GetNetworkSettings]
ReadPrec GetNetworkSettings
Int -> ReadS GetNetworkSettings
ReadS [GetNetworkSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNetworkSettings]
$creadListPrec :: ReadPrec [GetNetworkSettings]
readPrec :: ReadPrec GetNetworkSettings
$creadPrec :: ReadPrec GetNetworkSettings
readList :: ReadS [GetNetworkSettings]
$creadList :: ReadS [GetNetworkSettings]
readsPrec :: Int -> ReadS GetNetworkSettings
$creadsPrec :: Int -> ReadS GetNetworkSettings
Prelude.Read, Int -> GetNetworkSettings -> ShowS
[GetNetworkSettings] -> ShowS
GetNetworkSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNetworkSettings] -> ShowS
$cshowList :: [GetNetworkSettings] -> ShowS
show :: GetNetworkSettings -> String
$cshow :: GetNetworkSettings -> String
showsPrec :: Int -> GetNetworkSettings -> ShowS
$cshowsPrec :: Int -> GetNetworkSettings -> ShowS
Prelude.Show, forall x. Rep GetNetworkSettings x -> GetNetworkSettings
forall x. GetNetworkSettings -> Rep GetNetworkSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNetworkSettings x -> GetNetworkSettings
$cfrom :: forall x. GetNetworkSettings -> Rep GetNetworkSettings x
Prelude.Generic)

-- |
-- Create a value of 'GetNetworkSettings' 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:
--
-- 'networkSettingsArn', 'getNetworkSettings_networkSettingsArn' - The ARN of the network settings.
newGetNetworkSettings ::
  -- | 'networkSettingsArn'
  Prelude.Text ->
  GetNetworkSettings
newGetNetworkSettings :: Text -> GetNetworkSettings
newGetNetworkSettings Text
pNetworkSettingsArn_ =
  GetNetworkSettings'
    { $sel:networkSettingsArn:GetNetworkSettings' :: Text
networkSettingsArn =
        Text
pNetworkSettingsArn_
    }

-- | The ARN of the network settings.
getNetworkSettings_networkSettingsArn :: Lens.Lens' GetNetworkSettings Prelude.Text
getNetworkSettings_networkSettingsArn :: Lens' GetNetworkSettings Text
getNetworkSettings_networkSettingsArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkSettings' {Text
networkSettingsArn :: Text
$sel:networkSettingsArn:GetNetworkSettings' :: GetNetworkSettings -> Text
networkSettingsArn} -> Text
networkSettingsArn) (\s :: GetNetworkSettings
s@GetNetworkSettings' {} Text
a -> GetNetworkSettings
s {$sel:networkSettingsArn:GetNetworkSettings' :: Text
networkSettingsArn = Text
a} :: GetNetworkSettings)

instance Core.AWSRequest GetNetworkSettings where
  type
    AWSResponse GetNetworkSettings =
      GetNetworkSettingsResponse
  request :: (Service -> Service)
-> GetNetworkSettings -> Request GetNetworkSettings
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 GetNetworkSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNetworkSettings)))
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 NetworkSettings -> Int -> GetNetworkSettingsResponse
GetNetworkSettingsResponse'
            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 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 GetNetworkSettings where
  hashWithSalt :: Int -> GetNetworkSettings -> Int
hashWithSalt Int
_salt GetNetworkSettings' {Text
networkSettingsArn :: Text
$sel:networkSettingsArn:GetNetworkSettings' :: GetNetworkSettings -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkSettingsArn

instance Prelude.NFData GetNetworkSettings where
  rnf :: GetNetworkSettings -> ()
rnf GetNetworkSettings' {Text
networkSettingsArn :: Text
$sel:networkSettingsArn:GetNetworkSettings' :: GetNetworkSettings -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
networkSettingsArn

instance Data.ToHeaders GetNetworkSettings where
  toHeaders :: GetNetworkSettings -> 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 GetNetworkSettings where
  toPath :: GetNetworkSettings -> ByteString
toPath GetNetworkSettings' {Text
networkSettingsArn :: Text
$sel:networkSettingsArn:GetNetworkSettings' :: GetNetworkSettings -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/networkSettings/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
networkSettingsArn]

instance Data.ToQuery GetNetworkSettings where
  toQuery :: GetNetworkSettings -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetNetworkSettingsResponse' smart constructor.
data GetNetworkSettingsResponse = GetNetworkSettingsResponse'
  { -- | The network settings.
    GetNetworkSettingsResponse -> Maybe NetworkSettings
networkSettings :: Prelude.Maybe NetworkSettings,
    -- | The response's http status code.
    GetNetworkSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetNetworkSettingsResponse -> GetNetworkSettingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNetworkSettingsResponse -> GetNetworkSettingsResponse -> Bool
$c/= :: GetNetworkSettingsResponse -> GetNetworkSettingsResponse -> Bool
== :: GetNetworkSettingsResponse -> GetNetworkSettingsResponse -> Bool
$c== :: GetNetworkSettingsResponse -> GetNetworkSettingsResponse -> Bool
Prelude.Eq, ReadPrec [GetNetworkSettingsResponse]
ReadPrec GetNetworkSettingsResponse
Int -> ReadS GetNetworkSettingsResponse
ReadS [GetNetworkSettingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNetworkSettingsResponse]
$creadListPrec :: ReadPrec [GetNetworkSettingsResponse]
readPrec :: ReadPrec GetNetworkSettingsResponse
$creadPrec :: ReadPrec GetNetworkSettingsResponse
readList :: ReadS [GetNetworkSettingsResponse]
$creadList :: ReadS [GetNetworkSettingsResponse]
readsPrec :: Int -> ReadS GetNetworkSettingsResponse
$creadsPrec :: Int -> ReadS GetNetworkSettingsResponse
Prelude.Read, Int -> GetNetworkSettingsResponse -> ShowS
[GetNetworkSettingsResponse] -> ShowS
GetNetworkSettingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNetworkSettingsResponse] -> ShowS
$cshowList :: [GetNetworkSettingsResponse] -> ShowS
show :: GetNetworkSettingsResponse -> String
$cshow :: GetNetworkSettingsResponse -> String
showsPrec :: Int -> GetNetworkSettingsResponse -> ShowS
$cshowsPrec :: Int -> GetNetworkSettingsResponse -> ShowS
Prelude.Show, forall x.
Rep GetNetworkSettingsResponse x -> GetNetworkSettingsResponse
forall x.
GetNetworkSettingsResponse -> Rep GetNetworkSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetNetworkSettingsResponse x -> GetNetworkSettingsResponse
$cfrom :: forall x.
GetNetworkSettingsResponse -> Rep GetNetworkSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetNetworkSettingsResponse' 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', 'getNetworkSettingsResponse_networkSettings' - The network settings.
--
-- 'httpStatus', 'getNetworkSettingsResponse_httpStatus' - The response's http status code.
newGetNetworkSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetNetworkSettingsResponse
newGetNetworkSettingsResponse :: Int -> GetNetworkSettingsResponse
newGetNetworkSettingsResponse Int
pHttpStatus_ =
  GetNetworkSettingsResponse'
    { $sel:networkSettings:GetNetworkSettingsResponse' :: Maybe NetworkSettings
networkSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetNetworkSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The network settings.
getNetworkSettingsResponse_networkSettings :: Lens.Lens' GetNetworkSettingsResponse (Prelude.Maybe NetworkSettings)
getNetworkSettingsResponse_networkSettings :: Lens' GetNetworkSettingsResponse (Maybe NetworkSettings)
getNetworkSettingsResponse_networkSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkSettingsResponse' {Maybe NetworkSettings
networkSettings :: Maybe NetworkSettings
$sel:networkSettings:GetNetworkSettingsResponse' :: GetNetworkSettingsResponse -> Maybe NetworkSettings
networkSettings} -> Maybe NetworkSettings
networkSettings) (\s :: GetNetworkSettingsResponse
s@GetNetworkSettingsResponse' {} Maybe NetworkSettings
a -> GetNetworkSettingsResponse
s {$sel:networkSettings:GetNetworkSettingsResponse' :: Maybe NetworkSettings
networkSettings = Maybe NetworkSettings
a} :: GetNetworkSettingsResponse)

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

instance Prelude.NFData GetNetworkSettingsResponse where
  rnf :: GetNetworkSettingsResponse -> ()
rnf GetNetworkSettingsResponse' {Int
Maybe NetworkSettings
httpStatus :: Int
networkSettings :: Maybe NetworkSettings
$sel:httpStatus:GetNetworkSettingsResponse' :: GetNetworkSettingsResponse -> Int
$sel:networkSettings:GetNetworkSettingsResponse' :: GetNetworkSettingsResponse -> Maybe NetworkSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NetworkSettings
networkSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus