packages feed

amazonka-workspaces-web-2.0: gen/Amazonka/WorkSpacesWeb/UpdateUserSettings.hs

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

    -- * Request Lenses
    updateUserSettings_clientToken,
    updateUserSettings_copyAllowed,
    updateUserSettings_disconnectTimeoutInMinutes,
    updateUserSettings_downloadAllowed,
    updateUserSettings_idleDisconnectTimeoutInMinutes,
    updateUserSettings_pasteAllowed,
    updateUserSettings_printAllowed,
    updateUserSettings_uploadAllowed,
    updateUserSettings_userSettingsArn,

    -- * Destructuring the Response
    UpdateUserSettingsResponse (..),
    newUpdateUserSettingsResponse,

    -- * Response Lenses
    updateUserSettingsResponse_httpStatus,
    updateUserSettingsResponse_userSettings,
  )
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:/ 'newUpdateUserSettings' smart constructor.
data UpdateUserSettings = UpdateUserSettings'
  { -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request. Idempotency ensures that an API request
    -- completes only once. With an idempotent request, if the original request
    -- completes successfully, subsequent retries with the same client token
    -- return the result from the original successful request.
    --
    -- If you do not specify a client token, one is automatically generated by
    -- the AWS SDK.
    clientToken :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the user can copy text from the streaming session to
    -- the local device.
    copyAllowed :: Prelude.Maybe EnabledType,
    -- | The amount of time that a streaming session remains active after users
    -- disconnect.
    disconnectTimeoutInMinutes :: Prelude.Maybe Prelude.Natural,
    -- | Specifies whether the user can download files from the streaming session
    -- to the local device.
    downloadAllowed :: Prelude.Maybe EnabledType,
    -- | The amount of time that users can be idle (inactive) before they are
    -- disconnected from their streaming session and the disconnect timeout
    -- interval begins.
    idleDisconnectTimeoutInMinutes :: Prelude.Maybe Prelude.Natural,
    -- | Specifies whether the user can paste text from the local device to the
    -- streaming session.
    pasteAllowed :: Prelude.Maybe EnabledType,
    -- | Specifies whether the user can print to the local device.
    printAllowed :: Prelude.Maybe EnabledType,
    -- | Specifies whether the user can upload files from the local device to the
    -- streaming session.
    uploadAllowed :: Prelude.Maybe EnabledType,
    -- | The ARN of the user settings.
    userSettingsArn :: Prelude.Text
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'UpdateUserSettings' 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:
--
-- 'clientToken', 'updateUserSettings_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. Idempotency ensures that an API request
-- completes only once. With an idempotent request, if the original request
-- completes successfully, subsequent retries with the same client token
-- return the result from the original successful request.
--
-- If you do not specify a client token, one is automatically generated by
-- the AWS SDK.
--
-- 'copyAllowed', 'updateUserSettings_copyAllowed' - Specifies whether the user can copy text from the streaming session to
-- the local device.
--
-- 'disconnectTimeoutInMinutes', 'updateUserSettings_disconnectTimeoutInMinutes' - The amount of time that a streaming session remains active after users
-- disconnect.
--
-- 'downloadAllowed', 'updateUserSettings_downloadAllowed' - Specifies whether the user can download files from the streaming session
-- to the local device.
--
-- 'idleDisconnectTimeoutInMinutes', 'updateUserSettings_idleDisconnectTimeoutInMinutes' - The amount of time that users can be idle (inactive) before they are
-- disconnected from their streaming session and the disconnect timeout
-- interval begins.
--
-- 'pasteAllowed', 'updateUserSettings_pasteAllowed' - Specifies whether the user can paste text from the local device to the
-- streaming session.
--
-- 'printAllowed', 'updateUserSettings_printAllowed' - Specifies whether the user can print to the local device.
--
-- 'uploadAllowed', 'updateUserSettings_uploadAllowed' - Specifies whether the user can upload files from the local device to the
-- streaming session.
--
-- 'userSettingsArn', 'updateUserSettings_userSettingsArn' - The ARN of the user settings.
newUpdateUserSettings ::
  -- | 'userSettingsArn'
  Prelude.Text ->
  UpdateUserSettings
newUpdateUserSettings pUserSettingsArn_ =
  UpdateUserSettings'
    { clientToken = Prelude.Nothing,
      copyAllowed = Prelude.Nothing,
      disconnectTimeoutInMinutes = Prelude.Nothing,
      downloadAllowed = Prelude.Nothing,
      idleDisconnectTimeoutInMinutes = Prelude.Nothing,
      pasteAllowed = Prelude.Nothing,
      printAllowed = Prelude.Nothing,
      uploadAllowed = Prelude.Nothing,
      userSettingsArn = pUserSettingsArn_
    }

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. Idempotency ensures that an API request
-- completes only once. With an idempotent request, if the original request
-- completes successfully, subsequent retries with the same client token
-- return the result from the original successful request.
--
-- If you do not specify a client token, one is automatically generated by
-- the AWS SDK.
updateUserSettings_clientToken :: Lens.Lens' UpdateUserSettings (Prelude.Maybe Prelude.Text)
updateUserSettings_clientToken = Lens.lens (\UpdateUserSettings' {clientToken} -> clientToken) (\s@UpdateUserSettings' {} a -> s {clientToken = a} :: UpdateUserSettings)

-- | Specifies whether the user can copy text from the streaming session to
-- the local device.
updateUserSettings_copyAllowed :: Lens.Lens' UpdateUserSettings (Prelude.Maybe EnabledType)
updateUserSettings_copyAllowed = Lens.lens (\UpdateUserSettings' {copyAllowed} -> copyAllowed) (\s@UpdateUserSettings' {} a -> s {copyAllowed = a} :: UpdateUserSettings)

-- | The amount of time that a streaming session remains active after users
-- disconnect.
updateUserSettings_disconnectTimeoutInMinutes :: Lens.Lens' UpdateUserSettings (Prelude.Maybe Prelude.Natural)
updateUserSettings_disconnectTimeoutInMinutes = Lens.lens (\UpdateUserSettings' {disconnectTimeoutInMinutes} -> disconnectTimeoutInMinutes) (\s@UpdateUserSettings' {} a -> s {disconnectTimeoutInMinutes = a} :: UpdateUserSettings)

-- | Specifies whether the user can download files from the streaming session
-- to the local device.
updateUserSettings_downloadAllowed :: Lens.Lens' UpdateUserSettings (Prelude.Maybe EnabledType)
updateUserSettings_downloadAllowed = Lens.lens (\UpdateUserSettings' {downloadAllowed} -> downloadAllowed) (\s@UpdateUserSettings' {} a -> s {downloadAllowed = a} :: UpdateUserSettings)

-- | The amount of time that users can be idle (inactive) before they are
-- disconnected from their streaming session and the disconnect timeout
-- interval begins.
updateUserSettings_idleDisconnectTimeoutInMinutes :: Lens.Lens' UpdateUserSettings (Prelude.Maybe Prelude.Natural)
updateUserSettings_idleDisconnectTimeoutInMinutes = Lens.lens (\UpdateUserSettings' {idleDisconnectTimeoutInMinutes} -> idleDisconnectTimeoutInMinutes) (\s@UpdateUserSettings' {} a -> s {idleDisconnectTimeoutInMinutes = a} :: UpdateUserSettings)

-- | Specifies whether the user can paste text from the local device to the
-- streaming session.
updateUserSettings_pasteAllowed :: Lens.Lens' UpdateUserSettings (Prelude.Maybe EnabledType)
updateUserSettings_pasteAllowed = Lens.lens (\UpdateUserSettings' {pasteAllowed} -> pasteAllowed) (\s@UpdateUserSettings' {} a -> s {pasteAllowed = a} :: UpdateUserSettings)

-- | Specifies whether the user can print to the local device.
updateUserSettings_printAllowed :: Lens.Lens' UpdateUserSettings (Prelude.Maybe EnabledType)
updateUserSettings_printAllowed = Lens.lens (\UpdateUserSettings' {printAllowed} -> printAllowed) (\s@UpdateUserSettings' {} a -> s {printAllowed = a} :: UpdateUserSettings)

-- | Specifies whether the user can upload files from the local device to the
-- streaming session.
updateUserSettings_uploadAllowed :: Lens.Lens' UpdateUserSettings (Prelude.Maybe EnabledType)
updateUserSettings_uploadAllowed = Lens.lens (\UpdateUserSettings' {uploadAllowed} -> uploadAllowed) (\s@UpdateUserSettings' {} a -> s {uploadAllowed = a} :: UpdateUserSettings)

-- | The ARN of the user settings.
updateUserSettings_userSettingsArn :: Lens.Lens' UpdateUserSettings Prelude.Text
updateUserSettings_userSettingsArn = Lens.lens (\UpdateUserSettings' {userSettingsArn} -> userSettingsArn) (\s@UpdateUserSettings' {} a -> s {userSettingsArn = a} :: UpdateUserSettings)

instance Core.AWSRequest UpdateUserSettings where
  type
    AWSResponse UpdateUserSettings =
      UpdateUserSettingsResponse
  request overrides =
    Request.patchJSON (overrides defaultService)
  response =
    Response.receiveJSON
      ( \s h x ->
          UpdateUserSettingsResponse'
            Prelude.<$> (Prelude.pure (Prelude.fromEnum s))
            Prelude.<*> (x Data..:> "userSettings")
      )

instance Prelude.Hashable UpdateUserSettings where
  hashWithSalt _salt UpdateUserSettings' {..} =
    _salt
      `Prelude.hashWithSalt` clientToken
      `Prelude.hashWithSalt` copyAllowed
      `Prelude.hashWithSalt` disconnectTimeoutInMinutes
      `Prelude.hashWithSalt` downloadAllowed
      `Prelude.hashWithSalt` idleDisconnectTimeoutInMinutes
      `Prelude.hashWithSalt` pasteAllowed
      `Prelude.hashWithSalt` printAllowed
      `Prelude.hashWithSalt` uploadAllowed
      `Prelude.hashWithSalt` userSettingsArn

instance Prelude.NFData UpdateUserSettings where
  rnf UpdateUserSettings' {..} =
    Prelude.rnf clientToken
      `Prelude.seq` Prelude.rnf copyAllowed
      `Prelude.seq` Prelude.rnf disconnectTimeoutInMinutes
      `Prelude.seq` Prelude.rnf downloadAllowed
      `Prelude.seq` Prelude.rnf idleDisconnectTimeoutInMinutes
      `Prelude.seq` Prelude.rnf pasteAllowed
      `Prelude.seq` Prelude.rnf printAllowed
      `Prelude.seq` Prelude.rnf uploadAllowed
      `Prelude.seq` Prelude.rnf userSettingsArn

instance Data.ToHeaders UpdateUserSettings where
  toHeaders =
    Prelude.const
      ( Prelude.mconcat
          [ "Content-Type"
              Data.=# ( "application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateUserSettings where
  toJSON UpdateUserSettings' {..} =
    Data.object
      ( Prelude.catMaybes
          [ ("clientToken" Data..=) Prelude.<$> clientToken,
            ("copyAllowed" Data..=) Prelude.<$> copyAllowed,
            ("disconnectTimeoutInMinutes" Data..=)
              Prelude.<$> disconnectTimeoutInMinutes,
            ("downloadAllowed" Data..=)
              Prelude.<$> downloadAllowed,
            ("idleDisconnectTimeoutInMinutes" Data..=)
              Prelude.<$> idleDisconnectTimeoutInMinutes,
            ("pasteAllowed" Data..=) Prelude.<$> pasteAllowed,
            ("printAllowed" Data..=) Prelude.<$> printAllowed,
            ("uploadAllowed" Data..=) Prelude.<$> uploadAllowed
          ]
      )

instance Data.ToPath UpdateUserSettings where
  toPath UpdateUserSettings' {..} =
    Prelude.mconcat
      ["/userSettings/", Data.toBS userSettingsArn]

instance Data.ToQuery UpdateUserSettings where
  toQuery = Prelude.const Prelude.mempty

-- | /See:/ 'newUpdateUserSettingsResponse' smart constructor.
data UpdateUserSettingsResponse = UpdateUserSettingsResponse'
  { -- | The response's http status code.
    httpStatus :: Prelude.Int,
    -- | The user settings.
    userSettings :: UserSettings
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'UpdateUserSettingsResponse' 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', 'updateUserSettingsResponse_httpStatus' - The response's http status code.
--
-- 'userSettings', 'updateUserSettingsResponse_userSettings' - The user settings.
newUpdateUserSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'userSettings'
  UserSettings ->
  UpdateUserSettingsResponse
newUpdateUserSettingsResponse
  pHttpStatus_
  pUserSettings_ =
    UpdateUserSettingsResponse'
      { httpStatus =
          pHttpStatus_,
        userSettings = pUserSettings_
      }

-- | The response's http status code.
updateUserSettingsResponse_httpStatus :: Lens.Lens' UpdateUserSettingsResponse Prelude.Int
updateUserSettingsResponse_httpStatus = Lens.lens (\UpdateUserSettingsResponse' {httpStatus} -> httpStatus) (\s@UpdateUserSettingsResponse' {} a -> s {httpStatus = a} :: UpdateUserSettingsResponse)

-- | The user settings.
updateUserSettingsResponse_userSettings :: Lens.Lens' UpdateUserSettingsResponse UserSettings
updateUserSettingsResponse_userSettings = Lens.lens (\UpdateUserSettingsResponse' {userSettings} -> userSettings) (\s@UpdateUserSettingsResponse' {} a -> s {userSettings = a} :: UpdateUserSettingsResponse)

instance Prelude.NFData UpdateUserSettingsResponse where
  rnf UpdateUserSettingsResponse' {..} =
    Prelude.rnf httpStatus
      `Prelude.seq` Prelude.rnf userSettings