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

    -- * Request Lenses
    associateNetworkSettings_networkSettingsArn,
    associateNetworkSettings_portalArn,

    -- * Destructuring the Response
    AssociateNetworkSettingsResponse (..),
    newAssociateNetworkSettingsResponse,

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

-- |
-- Create a value of 'AssociateNetworkSettings' 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', 'associateNetworkSettings_networkSettingsArn' - The ARN of the network settings.
--
-- 'portalArn', 'associateNetworkSettings_portalArn' - The ARN of the web portal.
newAssociateNetworkSettings ::
  -- | 'networkSettingsArn'
  Prelude.Text ->
  -- | 'portalArn'
  Prelude.Text ->
  AssociateNetworkSettings
newAssociateNetworkSettings :: Text -> Text -> AssociateNetworkSettings
newAssociateNetworkSettings
  Text
pNetworkSettingsArn_
  Text
pPortalArn_ =
    AssociateNetworkSettings'
      { $sel:networkSettingsArn:AssociateNetworkSettings' :: Text
networkSettingsArn =
          Text
pNetworkSettingsArn_,
        $sel:portalArn:AssociateNetworkSettings' :: Text
portalArn = Text
pPortalArn_
      }

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

-- | The ARN of the web portal.
associateNetworkSettings_portalArn :: Lens.Lens' AssociateNetworkSettings Prelude.Text
associateNetworkSettings_portalArn :: Lens' AssociateNetworkSettings Text
associateNetworkSettings_portalArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateNetworkSettings' {Text
portalArn :: Text
$sel:portalArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
portalArn} -> Text
portalArn) (\s :: AssociateNetworkSettings
s@AssociateNetworkSettings' {} Text
a -> AssociateNetworkSettings
s {$sel:portalArn:AssociateNetworkSettings' :: Text
portalArn = Text
a} :: AssociateNetworkSettings)

instance Core.AWSRequest AssociateNetworkSettings where
  type
    AWSResponse AssociateNetworkSettings =
      AssociateNetworkSettingsResponse
  request :: (Service -> Service)
-> AssociateNetworkSettings -> Request AssociateNetworkSettings
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateNetworkSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateNetworkSettings)))
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 ->
          Int -> Text -> Text -> AssociateNetworkSettingsResponse
AssociateNetworkSettingsResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"networkSettingsArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"portalArn")
      )

instance Prelude.Hashable AssociateNetworkSettings where
  hashWithSalt :: Int -> AssociateNetworkSettings -> Int
hashWithSalt Int
_salt AssociateNetworkSettings' {Text
portalArn :: Text
networkSettingsArn :: Text
$sel:portalArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
$sel:networkSettingsArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkSettingsArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
portalArn

instance Prelude.NFData AssociateNetworkSettings where
  rnf :: AssociateNetworkSettings -> ()
rnf AssociateNetworkSettings' {Text
portalArn :: Text
networkSettingsArn :: Text
$sel:portalArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
$sel:networkSettingsArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
networkSettingsArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
portalArn

instance Data.ToHeaders AssociateNetworkSettings where
  toHeaders :: AssociateNetworkSettings -> 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.ToJSON AssociateNetworkSettings where
  toJSON :: AssociateNetworkSettings -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath AssociateNetworkSettings where
  toPath :: AssociateNetworkSettings -> ByteString
toPath AssociateNetworkSettings' {Text
portalArn :: Text
networkSettingsArn :: Text
$sel:portalArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
$sel:networkSettingsArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/portals/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
portalArn,
        ByteString
"/networkSettings"
      ]

instance Data.ToQuery AssociateNetworkSettings where
  toQuery :: AssociateNetworkSettings -> QueryString
toQuery AssociateNetworkSettings' {Text
portalArn :: Text
networkSettingsArn :: Text
$sel:portalArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
$sel:networkSettingsArn:AssociateNetworkSettings' :: AssociateNetworkSettings -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"networkSettingsArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
networkSettingsArn]

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

-- |
-- Create a value of 'AssociateNetworkSettingsResponse' 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:
--
-- 'httpStatus', 'associateNetworkSettingsResponse_httpStatus' - The response's http status code.
--
-- 'networkSettingsArn', 'associateNetworkSettingsResponse_networkSettingsArn' - The ARN of the network settings.
--
-- 'portalArn', 'associateNetworkSettingsResponse_portalArn' - The ARN of the web portal.
newAssociateNetworkSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'networkSettingsArn'
  Prelude.Text ->
  -- | 'portalArn'
  Prelude.Text ->
  AssociateNetworkSettingsResponse
newAssociateNetworkSettingsResponse :: Int -> Text -> Text -> AssociateNetworkSettingsResponse
newAssociateNetworkSettingsResponse
  Int
pHttpStatus_
  Text
pNetworkSettingsArn_
  Text
pPortalArn_ =
    AssociateNetworkSettingsResponse'
      { $sel:httpStatus:AssociateNetworkSettingsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:networkSettingsArn:AssociateNetworkSettingsResponse' :: Text
networkSettingsArn = Text
pNetworkSettingsArn_,
        $sel:portalArn:AssociateNetworkSettingsResponse' :: Text
portalArn = Text
pPortalArn_
      }

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

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

-- | The ARN of the web portal.
associateNetworkSettingsResponse_portalArn :: Lens.Lens' AssociateNetworkSettingsResponse Prelude.Text
associateNetworkSettingsResponse_portalArn :: Lens' AssociateNetworkSettingsResponse Text
associateNetworkSettingsResponse_portalArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateNetworkSettingsResponse' {Text
portalArn :: Text
$sel:portalArn:AssociateNetworkSettingsResponse' :: AssociateNetworkSettingsResponse -> Text
portalArn} -> Text
portalArn) (\s :: AssociateNetworkSettingsResponse
s@AssociateNetworkSettingsResponse' {} Text
a -> AssociateNetworkSettingsResponse
s {$sel:portalArn:AssociateNetworkSettingsResponse' :: Text
portalArn = Text
a} :: AssociateNetworkSettingsResponse)

instance
  Prelude.NFData
    AssociateNetworkSettingsResponse
  where
  rnf :: AssociateNetworkSettingsResponse -> ()
rnf AssociateNetworkSettingsResponse' {Int
Text
portalArn :: Text
networkSettingsArn :: Text
httpStatus :: Int
$sel:portalArn:AssociateNetworkSettingsResponse' :: AssociateNetworkSettingsResponse -> Text
$sel:networkSettingsArn:AssociateNetworkSettingsResponse' :: AssociateNetworkSettingsResponse -> Text
$sel:httpStatus:AssociateNetworkSettingsResponse' :: AssociateNetworkSettingsResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
networkSettingsArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
portalArn