{-# 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.AssociateBrowserSettings
-- 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 browser settings resource with a web portal.
module Amazonka.WorkSpacesWeb.AssociateBrowserSettings
  ( -- * Creating a Request
    AssociateBrowserSettings (..),
    newAssociateBrowserSettings,

    -- * Request Lenses
    associateBrowserSettings_browserSettingsArn,
    associateBrowserSettings_portalArn,

    -- * Destructuring the Response
    AssociateBrowserSettingsResponse (..),
    newAssociateBrowserSettingsResponse,

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

-- |
-- Create a value of 'AssociateBrowserSettings' 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:
--
-- 'browserSettingsArn', 'associateBrowserSettings_browserSettingsArn' - The ARN of the browser settings.
--
-- 'portalArn', 'associateBrowserSettings_portalArn' - The ARN of the web portal.
newAssociateBrowserSettings ::
  -- | 'browserSettingsArn'
  Prelude.Text ->
  -- | 'portalArn'
  Prelude.Text ->
  AssociateBrowserSettings
newAssociateBrowserSettings :: Text -> Text -> AssociateBrowserSettings
newAssociateBrowserSettings
  Text
pBrowserSettingsArn_
  Text
pPortalArn_ =
    AssociateBrowserSettings'
      { $sel:browserSettingsArn:AssociateBrowserSettings' :: Text
browserSettingsArn =
          Text
pBrowserSettingsArn_,
        $sel:portalArn:AssociateBrowserSettings' :: Text
portalArn = Text
pPortalArn_
      }

-- | The ARN of the browser settings.
associateBrowserSettings_browserSettingsArn :: Lens.Lens' AssociateBrowserSettings Prelude.Text
associateBrowserSettings_browserSettingsArn :: Lens' AssociateBrowserSettings Text
associateBrowserSettings_browserSettingsArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateBrowserSettings' {Text
browserSettingsArn :: Text
$sel:browserSettingsArn:AssociateBrowserSettings' :: AssociateBrowserSettings -> Text
browserSettingsArn} -> Text
browserSettingsArn) (\s :: AssociateBrowserSettings
s@AssociateBrowserSettings' {} Text
a -> AssociateBrowserSettings
s {$sel:browserSettingsArn:AssociateBrowserSettings' :: Text
browserSettingsArn = Text
a} :: AssociateBrowserSettings)

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

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

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

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

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

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

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

-- |
-- Create a value of 'AssociateBrowserSettingsResponse' 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', 'associateBrowserSettingsResponse_httpStatus' - The response's http status code.
--
-- 'browserSettingsArn', 'associateBrowserSettingsResponse_browserSettingsArn' - The ARN of the browser settings.
--
-- 'portalArn', 'associateBrowserSettingsResponse_portalArn' - The ARN of the web portal.
newAssociateBrowserSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'browserSettingsArn'
  Prelude.Text ->
  -- | 'portalArn'
  Prelude.Text ->
  AssociateBrowserSettingsResponse
newAssociateBrowserSettingsResponse :: Int -> Text -> Text -> AssociateBrowserSettingsResponse
newAssociateBrowserSettingsResponse
  Int
pHttpStatus_
  Text
pBrowserSettingsArn_
  Text
pPortalArn_ =
    AssociateBrowserSettingsResponse'
      { $sel:httpStatus:AssociateBrowserSettingsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:browserSettingsArn:AssociateBrowserSettingsResponse' :: Text
browserSettingsArn = Text
pBrowserSettingsArn_,
        $sel:portalArn:AssociateBrowserSettingsResponse' :: Text
portalArn = Text
pPortalArn_
      }

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

-- | The ARN of the browser settings.
associateBrowserSettingsResponse_browserSettingsArn :: Lens.Lens' AssociateBrowserSettingsResponse Prelude.Text
associateBrowserSettingsResponse_browserSettingsArn :: Lens' AssociateBrowserSettingsResponse Text
associateBrowserSettingsResponse_browserSettingsArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateBrowserSettingsResponse' {Text
browserSettingsArn :: Text
$sel:browserSettingsArn:AssociateBrowserSettingsResponse' :: AssociateBrowserSettingsResponse -> Text
browserSettingsArn} -> Text
browserSettingsArn) (\s :: AssociateBrowserSettingsResponse
s@AssociateBrowserSettingsResponse' {} Text
a -> AssociateBrowserSettingsResponse
s {$sel:browserSettingsArn:AssociateBrowserSettingsResponse' :: Text
browserSettingsArn = Text
a} :: AssociateBrowserSettingsResponse)

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

instance
  Prelude.NFData
    AssociateBrowserSettingsResponse
  where
  rnf :: AssociateBrowserSettingsResponse -> ()
rnf AssociateBrowserSettingsResponse' {Int
Text
portalArn :: Text
browserSettingsArn :: Text
httpStatus :: Int
$sel:portalArn:AssociateBrowserSettingsResponse' :: AssociateBrowserSettingsResponse -> Text
$sel:browserSettingsArn:AssociateBrowserSettingsResponse' :: AssociateBrowserSettingsResponse -> Text
$sel:httpStatus:AssociateBrowserSettingsResponse' :: AssociateBrowserSettingsResponse -> 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
browserSettingsArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
portalArn