{-# 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.ModifyWorkspaceProperties
-- 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)
--
-- Modifies the specified WorkSpace properties. For important information
-- about how to modify the size of the root and user volumes, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html Modify a WorkSpace>.
module Amazonka.WorkSpaces.ModifyWorkspaceProperties
  ( -- * Creating a Request
    ModifyWorkspaceProperties (..),
    newModifyWorkspaceProperties,

    -- * Request Lenses
    modifyWorkspaceProperties_workspaceId,
    modifyWorkspaceProperties_workspaceProperties,

    -- * Destructuring the Response
    ModifyWorkspacePropertiesResponse (..),
    newModifyWorkspacePropertiesResponse,

    -- * Response Lenses
    modifyWorkspacePropertiesResponse_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:/ 'newModifyWorkspaceProperties' smart constructor.
data ModifyWorkspaceProperties = ModifyWorkspaceProperties'
  { -- | The identifier of the WorkSpace.
    ModifyWorkspaceProperties -> Text
workspaceId :: Prelude.Text,
    -- | The properties of the WorkSpace.
    ModifyWorkspaceProperties -> WorkspaceProperties
workspaceProperties :: WorkspaceProperties
  }
  deriving (ModifyWorkspaceProperties -> ModifyWorkspaceProperties -> Bool
(ModifyWorkspaceProperties -> ModifyWorkspaceProperties -> Bool)
-> (ModifyWorkspaceProperties -> ModifyWorkspaceProperties -> Bool)
-> Eq ModifyWorkspaceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyWorkspaceProperties -> ModifyWorkspaceProperties -> Bool
$c/= :: ModifyWorkspaceProperties -> ModifyWorkspaceProperties -> Bool
== :: ModifyWorkspaceProperties -> ModifyWorkspaceProperties -> Bool
$c== :: ModifyWorkspaceProperties -> ModifyWorkspaceProperties -> Bool
Prelude.Eq, ReadPrec [ModifyWorkspaceProperties]
ReadPrec ModifyWorkspaceProperties
Int -> ReadS ModifyWorkspaceProperties
ReadS [ModifyWorkspaceProperties]
(Int -> ReadS ModifyWorkspaceProperties)
-> ReadS [ModifyWorkspaceProperties]
-> ReadPrec ModifyWorkspaceProperties
-> ReadPrec [ModifyWorkspaceProperties]
-> Read ModifyWorkspaceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyWorkspaceProperties]
$creadListPrec :: ReadPrec [ModifyWorkspaceProperties]
readPrec :: ReadPrec ModifyWorkspaceProperties
$creadPrec :: ReadPrec ModifyWorkspaceProperties
readList :: ReadS [ModifyWorkspaceProperties]
$creadList :: ReadS [ModifyWorkspaceProperties]
readsPrec :: Int -> ReadS ModifyWorkspaceProperties
$creadsPrec :: Int -> ReadS ModifyWorkspaceProperties
Prelude.Read, Int -> ModifyWorkspaceProperties -> ShowS
[ModifyWorkspaceProperties] -> ShowS
ModifyWorkspaceProperties -> String
(Int -> ModifyWorkspaceProperties -> ShowS)
-> (ModifyWorkspaceProperties -> String)
-> ([ModifyWorkspaceProperties] -> ShowS)
-> Show ModifyWorkspaceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyWorkspaceProperties] -> ShowS
$cshowList :: [ModifyWorkspaceProperties] -> ShowS
show :: ModifyWorkspaceProperties -> String
$cshow :: ModifyWorkspaceProperties -> String
showsPrec :: Int -> ModifyWorkspaceProperties -> ShowS
$cshowsPrec :: Int -> ModifyWorkspaceProperties -> ShowS
Prelude.Show, (forall x.
 ModifyWorkspaceProperties -> Rep ModifyWorkspaceProperties x)
-> (forall x.
    Rep ModifyWorkspaceProperties x -> ModifyWorkspaceProperties)
-> Generic ModifyWorkspaceProperties
forall x.
Rep ModifyWorkspaceProperties x -> ModifyWorkspaceProperties
forall x.
ModifyWorkspaceProperties -> Rep ModifyWorkspaceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyWorkspaceProperties x -> ModifyWorkspaceProperties
$cfrom :: forall x.
ModifyWorkspaceProperties -> Rep ModifyWorkspaceProperties x
Prelude.Generic)

-- |
-- Create a value of 'ModifyWorkspaceProperties' 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:
--
-- 'workspaceId', 'modifyWorkspaceProperties_workspaceId' - The identifier of the WorkSpace.
--
-- 'workspaceProperties', 'modifyWorkspaceProperties_workspaceProperties' - The properties of the WorkSpace.
newModifyWorkspaceProperties ::
  -- | 'workspaceId'
  Prelude.Text ->
  -- | 'workspaceProperties'
  WorkspaceProperties ->
  ModifyWorkspaceProperties
newModifyWorkspaceProperties :: Text -> WorkspaceProperties -> ModifyWorkspaceProperties
newModifyWorkspaceProperties
  Text
pWorkspaceId_
  WorkspaceProperties
pWorkspaceProperties_ =
    ModifyWorkspaceProperties' :: Text -> WorkspaceProperties -> ModifyWorkspaceProperties
ModifyWorkspaceProperties'
      { $sel:workspaceId:ModifyWorkspaceProperties' :: Text
workspaceId =
          Text
pWorkspaceId_,
        $sel:workspaceProperties:ModifyWorkspaceProperties' :: WorkspaceProperties
workspaceProperties = WorkspaceProperties
pWorkspaceProperties_
      }

-- | The identifier of the WorkSpace.
modifyWorkspaceProperties_workspaceId :: Lens.Lens' ModifyWorkspaceProperties Prelude.Text
modifyWorkspaceProperties_workspaceId :: (Text -> f Text)
-> ModifyWorkspaceProperties -> f ModifyWorkspaceProperties
modifyWorkspaceProperties_workspaceId = (ModifyWorkspaceProperties -> Text)
-> (ModifyWorkspaceProperties -> Text -> ModifyWorkspaceProperties)
-> Lens
     ModifyWorkspaceProperties ModifyWorkspaceProperties Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyWorkspaceProperties' {Text
workspaceId :: Text
$sel:workspaceId:ModifyWorkspaceProperties' :: ModifyWorkspaceProperties -> Text
workspaceId} -> Text
workspaceId) (\s :: ModifyWorkspaceProperties
s@ModifyWorkspaceProperties' {} Text
a -> ModifyWorkspaceProperties
s {$sel:workspaceId:ModifyWorkspaceProperties' :: Text
workspaceId = Text
a} :: ModifyWorkspaceProperties)

-- | The properties of the WorkSpace.
modifyWorkspaceProperties_workspaceProperties :: Lens.Lens' ModifyWorkspaceProperties WorkspaceProperties
modifyWorkspaceProperties_workspaceProperties :: (WorkspaceProperties -> f WorkspaceProperties)
-> ModifyWorkspaceProperties -> f ModifyWorkspaceProperties
modifyWorkspaceProperties_workspaceProperties = (ModifyWorkspaceProperties -> WorkspaceProperties)
-> (ModifyWorkspaceProperties
    -> WorkspaceProperties -> ModifyWorkspaceProperties)
-> Lens
     ModifyWorkspaceProperties
     ModifyWorkspaceProperties
     WorkspaceProperties
     WorkspaceProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyWorkspaceProperties' {WorkspaceProperties
workspaceProperties :: WorkspaceProperties
$sel:workspaceProperties:ModifyWorkspaceProperties' :: ModifyWorkspaceProperties -> WorkspaceProperties
workspaceProperties} -> WorkspaceProperties
workspaceProperties) (\s :: ModifyWorkspaceProperties
s@ModifyWorkspaceProperties' {} WorkspaceProperties
a -> ModifyWorkspaceProperties
s {$sel:workspaceProperties:ModifyWorkspaceProperties' :: WorkspaceProperties
workspaceProperties = WorkspaceProperties
a} :: ModifyWorkspaceProperties)

instance Core.AWSRequest ModifyWorkspaceProperties where
  type
    AWSResponse ModifyWorkspaceProperties =
      ModifyWorkspacePropertiesResponse
  request :: ModifyWorkspaceProperties -> Request ModifyWorkspaceProperties
request = Service
-> ModifyWorkspaceProperties -> Request ModifyWorkspaceProperties
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyWorkspaceProperties
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyWorkspaceProperties)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ModifyWorkspaceProperties))
-> Logger
-> Service
-> Proxy ModifyWorkspaceProperties
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyWorkspaceProperties)))
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 -> ModifyWorkspacePropertiesResponse
ModifyWorkspacePropertiesResponse'
            (Int -> ModifyWorkspacePropertiesResponse)
-> Either String Int
-> Either String ModifyWorkspacePropertiesResponse
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 ModifyWorkspaceProperties

instance Prelude.NFData ModifyWorkspaceProperties

instance Core.ToHeaders ModifyWorkspaceProperties where
  toHeaders :: ModifyWorkspaceProperties -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ModifyWorkspaceProperties -> 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.ModifyWorkspaceProperties" ::
                          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 ModifyWorkspaceProperties where
  toJSON :: ModifyWorkspaceProperties -> Value
toJSON ModifyWorkspaceProperties' {Text
WorkspaceProperties
workspaceProperties :: WorkspaceProperties
workspaceId :: Text
$sel:workspaceProperties:ModifyWorkspaceProperties' :: ModifyWorkspaceProperties -> WorkspaceProperties
$sel:workspaceId:ModifyWorkspaceProperties' :: ModifyWorkspaceProperties -> 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
"WorkspaceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workspaceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"WorkspaceProperties" Text -> WorkspaceProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WorkspaceProperties
workspaceProperties)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    ModifyWorkspacePropertiesResponse