{-# 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.AppStream.DeleteDirectoryConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the specified Directory Config object from AppStream 2.0. This
-- object includes the information required to join streaming instances to
-- an Active Directory domain.
module Amazonka.AppStream.DeleteDirectoryConfig
  ( -- * Creating a Request
    DeleteDirectoryConfig (..),
    newDeleteDirectoryConfig,

    -- * Request Lenses
    deleteDirectoryConfig_directoryName,

    -- * Destructuring the Response
    DeleteDirectoryConfigResponse (..),
    newDeleteDirectoryConfigResponse,

    -- * Response Lenses
    deleteDirectoryConfigResponse_httpStatus,
  )
where

import Amazonka.AppStream.Types
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

-- | /See:/ 'newDeleteDirectoryConfig' smart constructor.
data DeleteDirectoryConfig = DeleteDirectoryConfig'
  { -- | The name of the directory configuration.
    DeleteDirectoryConfig -> Text
directoryName :: Prelude.Text
  }
  deriving (DeleteDirectoryConfig -> DeleteDirectoryConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDirectoryConfig -> DeleteDirectoryConfig -> Bool
$c/= :: DeleteDirectoryConfig -> DeleteDirectoryConfig -> Bool
== :: DeleteDirectoryConfig -> DeleteDirectoryConfig -> Bool
$c== :: DeleteDirectoryConfig -> DeleteDirectoryConfig -> Bool
Prelude.Eq, ReadPrec [DeleteDirectoryConfig]
ReadPrec DeleteDirectoryConfig
Int -> ReadS DeleteDirectoryConfig
ReadS [DeleteDirectoryConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDirectoryConfig]
$creadListPrec :: ReadPrec [DeleteDirectoryConfig]
readPrec :: ReadPrec DeleteDirectoryConfig
$creadPrec :: ReadPrec DeleteDirectoryConfig
readList :: ReadS [DeleteDirectoryConfig]
$creadList :: ReadS [DeleteDirectoryConfig]
readsPrec :: Int -> ReadS DeleteDirectoryConfig
$creadsPrec :: Int -> ReadS DeleteDirectoryConfig
Prelude.Read, Int -> DeleteDirectoryConfig -> ShowS
[DeleteDirectoryConfig] -> ShowS
DeleteDirectoryConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDirectoryConfig] -> ShowS
$cshowList :: [DeleteDirectoryConfig] -> ShowS
show :: DeleteDirectoryConfig -> String
$cshow :: DeleteDirectoryConfig -> String
showsPrec :: Int -> DeleteDirectoryConfig -> ShowS
$cshowsPrec :: Int -> DeleteDirectoryConfig -> ShowS
Prelude.Show, forall x. Rep DeleteDirectoryConfig x -> DeleteDirectoryConfig
forall x. DeleteDirectoryConfig -> Rep DeleteDirectoryConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDirectoryConfig x -> DeleteDirectoryConfig
$cfrom :: forall x. DeleteDirectoryConfig -> Rep DeleteDirectoryConfig x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDirectoryConfig' 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:
--
-- 'directoryName', 'deleteDirectoryConfig_directoryName' - The name of the directory configuration.
newDeleteDirectoryConfig ::
  -- | 'directoryName'
  Prelude.Text ->
  DeleteDirectoryConfig
newDeleteDirectoryConfig :: Text -> DeleteDirectoryConfig
newDeleteDirectoryConfig Text
pDirectoryName_ =
  DeleteDirectoryConfig'
    { $sel:directoryName:DeleteDirectoryConfig' :: Text
directoryName =
        Text
pDirectoryName_
    }

-- | The name of the directory configuration.
deleteDirectoryConfig_directoryName :: Lens.Lens' DeleteDirectoryConfig Prelude.Text
deleteDirectoryConfig_directoryName :: Lens' DeleteDirectoryConfig Text
deleteDirectoryConfig_directoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDirectoryConfig' {Text
directoryName :: Text
$sel:directoryName:DeleteDirectoryConfig' :: DeleteDirectoryConfig -> Text
directoryName} -> Text
directoryName) (\s :: DeleteDirectoryConfig
s@DeleteDirectoryConfig' {} Text
a -> DeleteDirectoryConfig
s {$sel:directoryName:DeleteDirectoryConfig' :: Text
directoryName = Text
a} :: DeleteDirectoryConfig)

instance Core.AWSRequest DeleteDirectoryConfig where
  type
    AWSResponse DeleteDirectoryConfig =
      DeleteDirectoryConfigResponse
  request :: (Service -> Service)
-> DeleteDirectoryConfig -> Request DeleteDirectoryConfig
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDirectoryConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDirectoryConfig)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteDirectoryConfigResponse
DeleteDirectoryConfigResponse'
            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))
      )

instance Prelude.Hashable DeleteDirectoryConfig where
  hashWithSalt :: Int -> DeleteDirectoryConfig -> Int
hashWithSalt Int
_salt DeleteDirectoryConfig' {Text
directoryName :: Text
$sel:directoryName:DeleteDirectoryConfig' :: DeleteDirectoryConfig -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryName

instance Prelude.NFData DeleteDirectoryConfig where
  rnf :: DeleteDirectoryConfig -> ()
rnf DeleteDirectoryConfig' {Text
directoryName :: Text
$sel:directoryName:DeleteDirectoryConfig' :: DeleteDirectoryConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
directoryName

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

instance Data.ToJSON DeleteDirectoryConfig where
  toJSON :: DeleteDirectoryConfig -> Value
toJSON DeleteDirectoryConfig' {Text
directoryName :: Text
$sel:directoryName:DeleteDirectoryConfig' :: DeleteDirectoryConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"DirectoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
directoryName)
          ]
      )

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

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

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

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

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

instance Prelude.NFData DeleteDirectoryConfigResponse where
  rnf :: DeleteDirectoryConfigResponse -> ()
rnf DeleteDirectoryConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDirectoryConfigResponse' :: DeleteDirectoryConfigResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus