{-# 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.WorkSpaces.ModifyWorkspaceAccessProperties
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Specifies which devices and operating systems users can use to access
-- their WorkSpaces. For more information, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/update-directory-details.html#control-device-access Control Device Access>.
module Amazonka.WorkSpaces.ModifyWorkspaceAccessProperties
  ( -- * Creating a Request
    ModifyWorkspaceAccessProperties (..),
    newModifyWorkspaceAccessProperties,

    -- * Request Lenses
    modifyWorkspaceAccessProperties_resourceId,
    modifyWorkspaceAccessProperties_workspaceAccessProperties,

    -- * Destructuring the Response
    ModifyWorkspaceAccessPropertiesResponse (..),
    newModifyWorkspaceAccessPropertiesResponse,

    -- * Response Lenses
    modifyWorkspaceAccessPropertiesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkSpaces.Types

-- | /See:/ 'newModifyWorkspaceAccessProperties' smart constructor.
data ModifyWorkspaceAccessProperties = ModifyWorkspaceAccessProperties'
  { -- | The identifier of the directory.
    ModifyWorkspaceAccessProperties -> Text
resourceId :: Prelude.Text,
    -- | The device types and operating systems to enable or disable for access.
    ModifyWorkspaceAccessProperties -> WorkspaceAccessProperties
workspaceAccessProperties :: WorkspaceAccessProperties
  }
  deriving (ModifyWorkspaceAccessProperties
-> ModifyWorkspaceAccessProperties -> Bool
(ModifyWorkspaceAccessProperties
 -> ModifyWorkspaceAccessProperties -> Bool)
-> (ModifyWorkspaceAccessProperties
    -> ModifyWorkspaceAccessProperties -> Bool)
-> Eq ModifyWorkspaceAccessProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyWorkspaceAccessProperties
-> ModifyWorkspaceAccessProperties -> Bool
$c/= :: ModifyWorkspaceAccessProperties
-> ModifyWorkspaceAccessProperties -> Bool
== :: ModifyWorkspaceAccessProperties
-> ModifyWorkspaceAccessProperties -> Bool
$c== :: ModifyWorkspaceAccessProperties
-> ModifyWorkspaceAccessProperties -> Bool
Prelude.Eq, ReadPrec [ModifyWorkspaceAccessProperties]
ReadPrec ModifyWorkspaceAccessProperties
Int -> ReadS ModifyWorkspaceAccessProperties
ReadS [ModifyWorkspaceAccessProperties]
(Int -> ReadS ModifyWorkspaceAccessProperties)
-> ReadS [ModifyWorkspaceAccessProperties]
-> ReadPrec ModifyWorkspaceAccessProperties
-> ReadPrec [ModifyWorkspaceAccessProperties]
-> Read ModifyWorkspaceAccessProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyWorkspaceAccessProperties]
$creadListPrec :: ReadPrec [ModifyWorkspaceAccessProperties]
readPrec :: ReadPrec ModifyWorkspaceAccessProperties
$creadPrec :: ReadPrec ModifyWorkspaceAccessProperties
readList :: ReadS [ModifyWorkspaceAccessProperties]
$creadList :: ReadS [ModifyWorkspaceAccessProperties]
readsPrec :: Int -> ReadS ModifyWorkspaceAccessProperties
$creadsPrec :: Int -> ReadS ModifyWorkspaceAccessProperties
Prelude.Read, Int -> ModifyWorkspaceAccessProperties -> ShowS
[ModifyWorkspaceAccessProperties] -> ShowS
ModifyWorkspaceAccessProperties -> String
(Int -> ModifyWorkspaceAccessProperties -> ShowS)
-> (ModifyWorkspaceAccessProperties -> String)
-> ([ModifyWorkspaceAccessProperties] -> ShowS)
-> Show ModifyWorkspaceAccessProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyWorkspaceAccessProperties] -> ShowS
$cshowList :: [ModifyWorkspaceAccessProperties] -> ShowS
show :: ModifyWorkspaceAccessProperties -> String
$cshow :: ModifyWorkspaceAccessProperties -> String
showsPrec :: Int -> ModifyWorkspaceAccessProperties -> ShowS
$cshowsPrec :: Int -> ModifyWorkspaceAccessProperties -> ShowS
Prelude.Show, (forall x.
 ModifyWorkspaceAccessProperties
 -> Rep ModifyWorkspaceAccessProperties x)
-> (forall x.
    Rep ModifyWorkspaceAccessProperties x
    -> ModifyWorkspaceAccessProperties)
-> Generic ModifyWorkspaceAccessProperties
forall x.
Rep ModifyWorkspaceAccessProperties x
-> ModifyWorkspaceAccessProperties
forall x.
ModifyWorkspaceAccessProperties
-> Rep ModifyWorkspaceAccessProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyWorkspaceAccessProperties x
-> ModifyWorkspaceAccessProperties
$cfrom :: forall x.
ModifyWorkspaceAccessProperties
-> Rep ModifyWorkspaceAccessProperties x
Prelude.Generic)

-- |
-- Create a value of 'ModifyWorkspaceAccessProperties' 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:
--
-- 'resourceId', 'modifyWorkspaceAccessProperties_resourceId' - The identifier of the directory.
--
-- 'workspaceAccessProperties', 'modifyWorkspaceAccessProperties_workspaceAccessProperties' - The device types and operating systems to enable or disable for access.
newModifyWorkspaceAccessProperties ::
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'workspaceAccessProperties'
  WorkspaceAccessProperties ->
  ModifyWorkspaceAccessProperties
newModifyWorkspaceAccessProperties :: Text
-> WorkspaceAccessProperties -> ModifyWorkspaceAccessProperties
newModifyWorkspaceAccessProperties
  Text
pResourceId_
  WorkspaceAccessProperties
pWorkspaceAccessProperties_ =
    ModifyWorkspaceAccessProperties' :: Text
-> WorkspaceAccessProperties -> ModifyWorkspaceAccessProperties
ModifyWorkspaceAccessProperties'
      { $sel:resourceId:ModifyWorkspaceAccessProperties' :: Text
resourceId =
          Text
pResourceId_,
        $sel:workspaceAccessProperties:ModifyWorkspaceAccessProperties' :: WorkspaceAccessProperties
workspaceAccessProperties =
          WorkspaceAccessProperties
pWorkspaceAccessProperties_
      }

-- | The identifier of the directory.
modifyWorkspaceAccessProperties_resourceId :: Lens.Lens' ModifyWorkspaceAccessProperties Prelude.Text
modifyWorkspaceAccessProperties_resourceId :: (Text -> f Text)
-> ModifyWorkspaceAccessProperties
-> f ModifyWorkspaceAccessProperties
modifyWorkspaceAccessProperties_resourceId = (ModifyWorkspaceAccessProperties -> Text)
-> (ModifyWorkspaceAccessProperties
    -> Text -> ModifyWorkspaceAccessProperties)
-> Lens
     ModifyWorkspaceAccessProperties
     ModifyWorkspaceAccessProperties
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyWorkspaceAccessProperties' {Text
resourceId :: Text
$sel:resourceId:ModifyWorkspaceAccessProperties' :: ModifyWorkspaceAccessProperties -> Text
resourceId} -> Text
resourceId) (\s :: ModifyWorkspaceAccessProperties
s@ModifyWorkspaceAccessProperties' {} Text
a -> ModifyWorkspaceAccessProperties
s {$sel:resourceId:ModifyWorkspaceAccessProperties' :: Text
resourceId = Text
a} :: ModifyWorkspaceAccessProperties)

-- | The device types and operating systems to enable or disable for access.
modifyWorkspaceAccessProperties_workspaceAccessProperties :: Lens.Lens' ModifyWorkspaceAccessProperties WorkspaceAccessProperties
modifyWorkspaceAccessProperties_workspaceAccessProperties :: (WorkspaceAccessProperties -> f WorkspaceAccessProperties)
-> ModifyWorkspaceAccessProperties
-> f ModifyWorkspaceAccessProperties
modifyWorkspaceAccessProperties_workspaceAccessProperties = (ModifyWorkspaceAccessProperties -> WorkspaceAccessProperties)
-> (ModifyWorkspaceAccessProperties
    -> WorkspaceAccessProperties -> ModifyWorkspaceAccessProperties)
-> Lens
     ModifyWorkspaceAccessProperties
     ModifyWorkspaceAccessProperties
     WorkspaceAccessProperties
     WorkspaceAccessProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyWorkspaceAccessProperties' {WorkspaceAccessProperties
workspaceAccessProperties :: WorkspaceAccessProperties
$sel:workspaceAccessProperties:ModifyWorkspaceAccessProperties' :: ModifyWorkspaceAccessProperties -> WorkspaceAccessProperties
workspaceAccessProperties} -> WorkspaceAccessProperties
workspaceAccessProperties) (\s :: ModifyWorkspaceAccessProperties
s@ModifyWorkspaceAccessProperties' {} WorkspaceAccessProperties
a -> ModifyWorkspaceAccessProperties
s {$sel:workspaceAccessProperties:ModifyWorkspaceAccessProperties' :: WorkspaceAccessProperties
workspaceAccessProperties = WorkspaceAccessProperties
a} :: ModifyWorkspaceAccessProperties)

instance
  Core.AWSRequest
    ModifyWorkspaceAccessProperties
  where
  type
    AWSResponse ModifyWorkspaceAccessProperties =
      ModifyWorkspaceAccessPropertiesResponse
  request :: ModifyWorkspaceAccessProperties
-> Request ModifyWorkspaceAccessProperties
request = Service
-> ModifyWorkspaceAccessProperties
-> Request ModifyWorkspaceAccessProperties
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyWorkspaceAccessProperties
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ModifyWorkspaceAccessProperties)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ModifyWorkspaceAccessProperties))
-> Logger
-> Service
-> Proxy ModifyWorkspaceAccessProperties
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ModifyWorkspaceAccessProperties)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> ModifyWorkspaceAccessPropertiesResponse
ModifyWorkspaceAccessPropertiesResponse'
            (Int -> ModifyWorkspaceAccessPropertiesResponse)
-> Either String Int
-> Either String ModifyWorkspaceAccessPropertiesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    ModifyWorkspaceAccessProperties

instance
  Prelude.NFData
    ModifyWorkspaceAccessProperties

instance
  Core.ToHeaders
    ModifyWorkspaceAccessProperties
  where
  toHeaders :: ModifyWorkspaceAccessProperties -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ModifyWorkspaceAccessProperties -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkspacesService.ModifyWorkspaceAccessProperties" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ModifyWorkspaceAccessProperties where
  toJSON :: ModifyWorkspaceAccessProperties -> Value
toJSON ModifyWorkspaceAccessProperties' {Text
WorkspaceAccessProperties
workspaceAccessProperties :: WorkspaceAccessProperties
resourceId :: Text
$sel:workspaceAccessProperties:ModifyWorkspaceAccessProperties' :: ModifyWorkspaceAccessProperties -> WorkspaceAccessProperties
$sel:resourceId:ModifyWorkspaceAccessProperties' :: ModifyWorkspaceAccessProperties -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"WorkspaceAccessProperties"
                  Text -> WorkspaceAccessProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WorkspaceAccessProperties
workspaceAccessProperties
              )
          ]
      )

instance Core.ToPath ModifyWorkspaceAccessProperties where
  toPath :: ModifyWorkspaceAccessProperties -> ByteString
toPath = ByteString -> ModifyWorkspaceAccessProperties -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ModifyWorkspaceAccessPropertiesResponse' 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', 'modifyWorkspaceAccessPropertiesResponse_httpStatus' - The response's http status code.
newModifyWorkspaceAccessPropertiesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyWorkspaceAccessPropertiesResponse
newModifyWorkspaceAccessPropertiesResponse :: Int -> ModifyWorkspaceAccessPropertiesResponse
newModifyWorkspaceAccessPropertiesResponse
  Int
pHttpStatus_ =
    ModifyWorkspaceAccessPropertiesResponse' :: Int -> ModifyWorkspaceAccessPropertiesResponse
ModifyWorkspaceAccessPropertiesResponse'
      { $sel:httpStatus:ModifyWorkspaceAccessPropertiesResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

instance
  Prelude.NFData
    ModifyWorkspaceAccessPropertiesResponse