{-# 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.RegisterWorkspaceDirectory
-- 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)
--
-- Registers the specified directory. This operation is asynchronous and
-- returns before the WorkSpace directory is registered. If this is the
-- first time you are registering a directory, you will need to create the
-- workspaces_DefaultRole role before you can register a directory. For
-- more information, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/workspaces-access-control.html#create-default-role Creating the workspaces_DefaultRole Role>.
module Amazonka.WorkSpaces.RegisterWorkspaceDirectory
  ( -- * Creating a Request
    RegisterWorkspaceDirectory (..),
    newRegisterWorkspaceDirectory,

    -- * Request Lenses
    registerWorkspaceDirectory_subnetIds,
    registerWorkspaceDirectory_enableSelfService,
    registerWorkspaceDirectory_tenancy,
    registerWorkspaceDirectory_tags,
    registerWorkspaceDirectory_directoryId,
    registerWorkspaceDirectory_enableWorkDocs,

    -- * Destructuring the Response
    RegisterWorkspaceDirectoryResponse (..),
    newRegisterWorkspaceDirectoryResponse,

    -- * Response Lenses
    registerWorkspaceDirectoryResponse_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:/ 'newRegisterWorkspaceDirectory' smart constructor.
data RegisterWorkspaceDirectory = RegisterWorkspaceDirectory'
  { -- | The identifiers of the subnets for your virtual private cloud (VPC).
    -- Make sure that the subnets are in supported Availability Zones. The
    -- subnets must also be in separate Availability Zones. If these conditions
    -- are not met, you will receive an OperationNotSupportedException error.
    RegisterWorkspaceDirectory -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | Indicates whether self-service capabilities are enabled or disabled.
    RegisterWorkspaceDirectory -> Maybe Bool
enableSelfService :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether your WorkSpace directory is dedicated or shared. To
    -- use Bring Your Own License (BYOL) images, this value must be set to
    -- @DEDICATED@ and your Amazon Web Services account must be enabled for
    -- BYOL. If your account has not been enabled for BYOL, you will receive an
    -- InvalidParameterValuesException error. For more information about BYOL
    -- images, see
    -- <https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html Bring Your Own Windows Desktop Images>.
    RegisterWorkspaceDirectory -> Maybe Tenancy
tenancy :: Prelude.Maybe Tenancy,
    -- | The tags associated with the directory.
    RegisterWorkspaceDirectory -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The identifier of the directory. You cannot register a directory if it
    -- does not have a status of Active. If the directory does not have a
    -- status of Active, you will receive an InvalidResourceStateException
    -- error. If you have already registered the maximum number of directories
    -- that you can register with Amazon WorkSpaces, you will receive a
    -- ResourceLimitExceededException error. Deregister directories that you
    -- are not using for WorkSpaces, and try again.
    RegisterWorkspaceDirectory -> Text
directoryId :: Prelude.Text,
    -- | Indicates whether Amazon WorkDocs is enabled or disabled. If you have
    -- enabled this parameter and WorkDocs is not available in the Region, you
    -- will receive an OperationNotSupportedException error. Set
    -- @EnableWorkDocs@ to disabled, and try again.
    RegisterWorkspaceDirectory -> Bool
enableWorkDocs :: Prelude.Bool
  }
  deriving (RegisterWorkspaceDirectory -> RegisterWorkspaceDirectory -> Bool
(RegisterWorkspaceDirectory -> RegisterWorkspaceDirectory -> Bool)
-> (RegisterWorkspaceDirectory
    -> RegisterWorkspaceDirectory -> Bool)
-> Eq RegisterWorkspaceDirectory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterWorkspaceDirectory -> RegisterWorkspaceDirectory -> Bool
$c/= :: RegisterWorkspaceDirectory -> RegisterWorkspaceDirectory -> Bool
== :: RegisterWorkspaceDirectory -> RegisterWorkspaceDirectory -> Bool
$c== :: RegisterWorkspaceDirectory -> RegisterWorkspaceDirectory -> Bool
Prelude.Eq, ReadPrec [RegisterWorkspaceDirectory]
ReadPrec RegisterWorkspaceDirectory
Int -> ReadS RegisterWorkspaceDirectory
ReadS [RegisterWorkspaceDirectory]
(Int -> ReadS RegisterWorkspaceDirectory)
-> ReadS [RegisterWorkspaceDirectory]
-> ReadPrec RegisterWorkspaceDirectory
-> ReadPrec [RegisterWorkspaceDirectory]
-> Read RegisterWorkspaceDirectory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterWorkspaceDirectory]
$creadListPrec :: ReadPrec [RegisterWorkspaceDirectory]
readPrec :: ReadPrec RegisterWorkspaceDirectory
$creadPrec :: ReadPrec RegisterWorkspaceDirectory
readList :: ReadS [RegisterWorkspaceDirectory]
$creadList :: ReadS [RegisterWorkspaceDirectory]
readsPrec :: Int -> ReadS RegisterWorkspaceDirectory
$creadsPrec :: Int -> ReadS RegisterWorkspaceDirectory
Prelude.Read, Int -> RegisterWorkspaceDirectory -> ShowS
[RegisterWorkspaceDirectory] -> ShowS
RegisterWorkspaceDirectory -> String
(Int -> RegisterWorkspaceDirectory -> ShowS)
-> (RegisterWorkspaceDirectory -> String)
-> ([RegisterWorkspaceDirectory] -> ShowS)
-> Show RegisterWorkspaceDirectory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterWorkspaceDirectory] -> ShowS
$cshowList :: [RegisterWorkspaceDirectory] -> ShowS
show :: RegisterWorkspaceDirectory -> String
$cshow :: RegisterWorkspaceDirectory -> String
showsPrec :: Int -> RegisterWorkspaceDirectory -> ShowS
$cshowsPrec :: Int -> RegisterWorkspaceDirectory -> ShowS
Prelude.Show, (forall x.
 RegisterWorkspaceDirectory -> Rep RegisterWorkspaceDirectory x)
-> (forall x.
    Rep RegisterWorkspaceDirectory x -> RegisterWorkspaceDirectory)
-> Generic RegisterWorkspaceDirectory
forall x.
Rep RegisterWorkspaceDirectory x -> RegisterWorkspaceDirectory
forall x.
RegisterWorkspaceDirectory -> Rep RegisterWorkspaceDirectory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterWorkspaceDirectory x -> RegisterWorkspaceDirectory
$cfrom :: forall x.
RegisterWorkspaceDirectory -> Rep RegisterWorkspaceDirectory x
Prelude.Generic)

-- |
-- Create a value of 'RegisterWorkspaceDirectory' 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:
--
-- 'subnetIds', 'registerWorkspaceDirectory_subnetIds' - The identifiers of the subnets for your virtual private cloud (VPC).
-- Make sure that the subnets are in supported Availability Zones. The
-- subnets must also be in separate Availability Zones. If these conditions
-- are not met, you will receive an OperationNotSupportedException error.
--
-- 'enableSelfService', 'registerWorkspaceDirectory_enableSelfService' - Indicates whether self-service capabilities are enabled or disabled.
--
-- 'tenancy', 'registerWorkspaceDirectory_tenancy' - Indicates whether your WorkSpace directory is dedicated or shared. To
-- use Bring Your Own License (BYOL) images, this value must be set to
-- @DEDICATED@ and your Amazon Web Services account must be enabled for
-- BYOL. If your account has not been enabled for BYOL, you will receive an
-- InvalidParameterValuesException error. For more information about BYOL
-- images, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html Bring Your Own Windows Desktop Images>.
--
-- 'tags', 'registerWorkspaceDirectory_tags' - The tags associated with the directory.
--
-- 'directoryId', 'registerWorkspaceDirectory_directoryId' - The identifier of the directory. You cannot register a directory if it
-- does not have a status of Active. If the directory does not have a
-- status of Active, you will receive an InvalidResourceStateException
-- error. If you have already registered the maximum number of directories
-- that you can register with Amazon WorkSpaces, you will receive a
-- ResourceLimitExceededException error. Deregister directories that you
-- are not using for WorkSpaces, and try again.
--
-- 'enableWorkDocs', 'registerWorkspaceDirectory_enableWorkDocs' - Indicates whether Amazon WorkDocs is enabled or disabled. If you have
-- enabled this parameter and WorkDocs is not available in the Region, you
-- will receive an OperationNotSupportedException error. Set
-- @EnableWorkDocs@ to disabled, and try again.
newRegisterWorkspaceDirectory ::
  -- | 'directoryId'
  Prelude.Text ->
  -- | 'enableWorkDocs'
  Prelude.Bool ->
  RegisterWorkspaceDirectory
newRegisterWorkspaceDirectory :: Text -> Bool -> RegisterWorkspaceDirectory
newRegisterWorkspaceDirectory
  Text
pDirectoryId_
  Bool
pEnableWorkDocs_ =
    RegisterWorkspaceDirectory' :: Maybe [Text]
-> Maybe Bool
-> Maybe Tenancy
-> Maybe [Tag]
-> Text
-> Bool
-> RegisterWorkspaceDirectory
RegisterWorkspaceDirectory'
      { $sel:subnetIds:RegisterWorkspaceDirectory' :: Maybe [Text]
subnetIds =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:enableSelfService:RegisterWorkspaceDirectory' :: Maybe Bool
enableSelfService = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:tenancy:RegisterWorkspaceDirectory' :: Maybe Tenancy
tenancy = Maybe Tenancy
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:RegisterWorkspaceDirectory' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:directoryId:RegisterWorkspaceDirectory' :: Text
directoryId = Text
pDirectoryId_,
        $sel:enableWorkDocs:RegisterWorkspaceDirectory' :: Bool
enableWorkDocs = Bool
pEnableWorkDocs_
      }

-- | The identifiers of the subnets for your virtual private cloud (VPC).
-- Make sure that the subnets are in supported Availability Zones. The
-- subnets must also be in separate Availability Zones. If these conditions
-- are not met, you will receive an OperationNotSupportedException error.
registerWorkspaceDirectory_subnetIds :: Lens.Lens' RegisterWorkspaceDirectory (Prelude.Maybe [Prelude.Text])
registerWorkspaceDirectory_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory
registerWorkspaceDirectory_subnetIds = (RegisterWorkspaceDirectory -> Maybe [Text])
-> (RegisterWorkspaceDirectory
    -> Maybe [Text] -> RegisterWorkspaceDirectory)
-> Lens
     RegisterWorkspaceDirectory
     RegisterWorkspaceDirectory
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkspaceDirectory' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: RegisterWorkspaceDirectory
s@RegisterWorkspaceDirectory' {} Maybe [Text]
a -> RegisterWorkspaceDirectory
s {$sel:subnetIds:RegisterWorkspaceDirectory' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: RegisterWorkspaceDirectory) ((Maybe [Text] -> f (Maybe [Text]))
 -> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> RegisterWorkspaceDirectory
-> f RegisterWorkspaceDirectory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates whether self-service capabilities are enabled or disabled.
registerWorkspaceDirectory_enableSelfService :: Lens.Lens' RegisterWorkspaceDirectory (Prelude.Maybe Prelude.Bool)
registerWorkspaceDirectory_enableSelfService :: (Maybe Bool -> f (Maybe Bool))
-> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory
registerWorkspaceDirectory_enableSelfService = (RegisterWorkspaceDirectory -> Maybe Bool)
-> (RegisterWorkspaceDirectory
    -> Maybe Bool -> RegisterWorkspaceDirectory)
-> Lens
     RegisterWorkspaceDirectory
     RegisterWorkspaceDirectory
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkspaceDirectory' {Maybe Bool
enableSelfService :: Maybe Bool
$sel:enableSelfService:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe Bool
enableSelfService} -> Maybe Bool
enableSelfService) (\s :: RegisterWorkspaceDirectory
s@RegisterWorkspaceDirectory' {} Maybe Bool
a -> RegisterWorkspaceDirectory
s {$sel:enableSelfService:RegisterWorkspaceDirectory' :: Maybe Bool
enableSelfService = Maybe Bool
a} :: RegisterWorkspaceDirectory)

-- | Indicates whether your WorkSpace directory is dedicated or shared. To
-- use Bring Your Own License (BYOL) images, this value must be set to
-- @DEDICATED@ and your Amazon Web Services account must be enabled for
-- BYOL. If your account has not been enabled for BYOL, you will receive an
-- InvalidParameterValuesException error. For more information about BYOL
-- images, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html Bring Your Own Windows Desktop Images>.
registerWorkspaceDirectory_tenancy :: Lens.Lens' RegisterWorkspaceDirectory (Prelude.Maybe Tenancy)
registerWorkspaceDirectory_tenancy :: (Maybe Tenancy -> f (Maybe Tenancy))
-> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory
registerWorkspaceDirectory_tenancy = (RegisterWorkspaceDirectory -> Maybe Tenancy)
-> (RegisterWorkspaceDirectory
    -> Maybe Tenancy -> RegisterWorkspaceDirectory)
-> Lens
     RegisterWorkspaceDirectory
     RegisterWorkspaceDirectory
     (Maybe Tenancy)
     (Maybe Tenancy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkspaceDirectory' {Maybe Tenancy
tenancy :: Maybe Tenancy
$sel:tenancy:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe Tenancy
tenancy} -> Maybe Tenancy
tenancy) (\s :: RegisterWorkspaceDirectory
s@RegisterWorkspaceDirectory' {} Maybe Tenancy
a -> RegisterWorkspaceDirectory
s {$sel:tenancy:RegisterWorkspaceDirectory' :: Maybe Tenancy
tenancy = Maybe Tenancy
a} :: RegisterWorkspaceDirectory)

-- | The tags associated with the directory.
registerWorkspaceDirectory_tags :: Lens.Lens' RegisterWorkspaceDirectory (Prelude.Maybe [Tag])
registerWorkspaceDirectory_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory
registerWorkspaceDirectory_tags = (RegisterWorkspaceDirectory -> Maybe [Tag])
-> (RegisterWorkspaceDirectory
    -> Maybe [Tag] -> RegisterWorkspaceDirectory)
-> Lens
     RegisterWorkspaceDirectory
     RegisterWorkspaceDirectory
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkspaceDirectory' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: RegisterWorkspaceDirectory
s@RegisterWorkspaceDirectory' {} Maybe [Tag]
a -> RegisterWorkspaceDirectory
s {$sel:tags:RegisterWorkspaceDirectory' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: RegisterWorkspaceDirectory) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterWorkspaceDirectory
-> f RegisterWorkspaceDirectory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the directory. You cannot register a directory if it
-- does not have a status of Active. If the directory does not have a
-- status of Active, you will receive an InvalidResourceStateException
-- error. If you have already registered the maximum number of directories
-- that you can register with Amazon WorkSpaces, you will receive a
-- ResourceLimitExceededException error. Deregister directories that you
-- are not using for WorkSpaces, and try again.
registerWorkspaceDirectory_directoryId :: Lens.Lens' RegisterWorkspaceDirectory Prelude.Text
registerWorkspaceDirectory_directoryId :: (Text -> f Text)
-> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory
registerWorkspaceDirectory_directoryId = (RegisterWorkspaceDirectory -> Text)
-> (RegisterWorkspaceDirectory
    -> Text -> RegisterWorkspaceDirectory)
-> Lens
     RegisterWorkspaceDirectory RegisterWorkspaceDirectory Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkspaceDirectory' {Text
directoryId :: Text
$sel:directoryId:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Text
directoryId} -> Text
directoryId) (\s :: RegisterWorkspaceDirectory
s@RegisterWorkspaceDirectory' {} Text
a -> RegisterWorkspaceDirectory
s {$sel:directoryId:RegisterWorkspaceDirectory' :: Text
directoryId = Text
a} :: RegisterWorkspaceDirectory)

-- | Indicates whether Amazon WorkDocs is enabled or disabled. If you have
-- enabled this parameter and WorkDocs is not available in the Region, you
-- will receive an OperationNotSupportedException error. Set
-- @EnableWorkDocs@ to disabled, and try again.
registerWorkspaceDirectory_enableWorkDocs :: Lens.Lens' RegisterWorkspaceDirectory Prelude.Bool
registerWorkspaceDirectory_enableWorkDocs :: (Bool -> f Bool)
-> RegisterWorkspaceDirectory -> f RegisterWorkspaceDirectory
registerWorkspaceDirectory_enableWorkDocs = (RegisterWorkspaceDirectory -> Bool)
-> (RegisterWorkspaceDirectory
    -> Bool -> RegisterWorkspaceDirectory)
-> Lens
     RegisterWorkspaceDirectory RegisterWorkspaceDirectory Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterWorkspaceDirectory' {Bool
enableWorkDocs :: Bool
$sel:enableWorkDocs:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Bool
enableWorkDocs} -> Bool
enableWorkDocs) (\s :: RegisterWorkspaceDirectory
s@RegisterWorkspaceDirectory' {} Bool
a -> RegisterWorkspaceDirectory
s {$sel:enableWorkDocs:RegisterWorkspaceDirectory' :: Bool
enableWorkDocs = Bool
a} :: RegisterWorkspaceDirectory)

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

instance Prelude.NFData RegisterWorkspaceDirectory

instance Core.ToHeaders RegisterWorkspaceDirectory where
  toHeaders :: RegisterWorkspaceDirectory -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RegisterWorkspaceDirectory -> 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.RegisterWorkspaceDirectory" ::
                          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 RegisterWorkspaceDirectory where
  toJSON :: RegisterWorkspaceDirectory -> Value
toJSON RegisterWorkspaceDirectory' {Bool
Maybe Bool
Maybe [Text]
Maybe [Tag]
Maybe Tenancy
Text
enableWorkDocs :: Bool
directoryId :: Text
tags :: Maybe [Tag]
tenancy :: Maybe Tenancy
enableSelfService :: Maybe Bool
subnetIds :: Maybe [Text]
$sel:enableWorkDocs:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Bool
$sel:directoryId:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Text
$sel:tags:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe [Tag]
$sel:tenancy:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe Tenancy
$sel:enableSelfService:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe Bool
$sel:subnetIds:RegisterWorkspaceDirectory' :: RegisterWorkspaceDirectory -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SubnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
subnetIds,
            (Text
"EnableSelfService" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableSelfService,
            (Text
"Tenancy" Text -> Tenancy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Tenancy -> Pair) -> Maybe Tenancy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Tenancy
tenancy,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EnableWorkDocs" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
enableWorkDocs)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    RegisterWorkspaceDirectoryResponse