{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteDirectoryConfig -> DeleteDirectoryConfig -> Bool)
-> (DeleteDirectoryConfig -> DeleteDirectoryConfig -> Bool)
-> Eq DeleteDirectoryConfig
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]
(Int -> ReadS DeleteDirectoryConfig)
-> ReadS [DeleteDirectoryConfig]
-> ReadPrec DeleteDirectoryConfig
-> ReadPrec [DeleteDirectoryConfig]
-> Read 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
(Int -> DeleteDirectoryConfig -> ShowS)
-> (DeleteDirectoryConfig -> String)
-> ([DeleteDirectoryConfig] -> ShowS)
-> Show DeleteDirectoryConfig
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. DeleteDirectoryConfig -> Rep DeleteDirectoryConfig x)
-> (forall x. Rep DeleteDirectoryConfig x -> DeleteDirectoryConfig)
-> Generic DeleteDirectoryConfig
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' :: Text -> DeleteDirectoryConfig
DeleteDirectoryConfig'
    { $sel:directoryName:DeleteDirectoryConfig' :: Text
directoryName =
        Text
pDirectoryName_
    }

-- | The name of the directory configuration.
deleteDirectoryConfig_directoryName :: Lens.Lens' DeleteDirectoryConfig Prelude.Text
deleteDirectoryConfig_directoryName :: (Text -> f Text)
-> DeleteDirectoryConfig -> f DeleteDirectoryConfig
deleteDirectoryConfig_directoryName = (DeleteDirectoryConfig -> Text)
-> (DeleteDirectoryConfig -> Text -> DeleteDirectoryConfig)
-> Lens DeleteDirectoryConfig DeleteDirectoryConfig Text Text
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 :: DeleteDirectoryConfig -> Request DeleteDirectoryConfig
request = Service -> DeleteDirectoryConfig -> Request DeleteDirectoryConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDirectoryConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDirectoryConfig)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteDirectoryConfig))
-> Logger
-> Service
-> Proxy DeleteDirectoryConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDirectoryConfig)))
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 -> DeleteDirectoryConfigResponse
DeleteDirectoryConfigResponse'
            (Int -> DeleteDirectoryConfigResponse)
-> Either String Int -> Either String DeleteDirectoryConfigResponse
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 DeleteDirectoryConfig

instance Prelude.NFData DeleteDirectoryConfig

instance Core.ToHeaders DeleteDirectoryConfig where
  toHeaders :: DeleteDirectoryConfig -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteDirectoryConfig -> 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
"PhotonAdminProxyService.DeleteDirectoryConfig" ::
                          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 DeleteDirectoryConfig where
  toJSON :: DeleteDirectoryConfig -> Value
toJSON DeleteDirectoryConfig' {Text
directoryName :: Text
$sel:directoryName:DeleteDirectoryConfig' :: DeleteDirectoryConfig -> 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
"DirectoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryName)
          ]
      )

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

instance Core.ToQuery DeleteDirectoryConfig where
  toQuery :: DeleteDirectoryConfig -> QueryString
toQuery = QueryString -> DeleteDirectoryConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteDirectoryConfigResponse
 -> DeleteDirectoryConfigResponse -> Bool)
-> (DeleteDirectoryConfigResponse
    -> DeleteDirectoryConfigResponse -> Bool)
-> Eq DeleteDirectoryConfigResponse
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]
(Int -> ReadS DeleteDirectoryConfigResponse)
-> ReadS [DeleteDirectoryConfigResponse]
-> ReadPrec DeleteDirectoryConfigResponse
-> ReadPrec [DeleteDirectoryConfigResponse]
-> Read 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
(Int -> DeleteDirectoryConfigResponse -> ShowS)
-> (DeleteDirectoryConfigResponse -> String)
-> ([DeleteDirectoryConfigResponse] -> ShowS)
-> Show DeleteDirectoryConfigResponse
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.
 DeleteDirectoryConfigResponse
 -> Rep DeleteDirectoryConfigResponse x)
-> (forall x.
    Rep DeleteDirectoryConfigResponse x
    -> DeleteDirectoryConfigResponse)
-> Generic DeleteDirectoryConfigResponse
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' :: Int -> DeleteDirectoryConfigResponse
DeleteDirectoryConfigResponse'
    { $sel:httpStatus:DeleteDirectoryConfigResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteDirectoryConfigResponse_httpStatus :: Lens.Lens' DeleteDirectoryConfigResponse Prelude.Int
deleteDirectoryConfigResponse_httpStatus :: (Int -> f Int)
-> DeleteDirectoryConfigResponse -> f DeleteDirectoryConfigResponse
deleteDirectoryConfigResponse_httpStatus = (DeleteDirectoryConfigResponse -> Int)
-> (DeleteDirectoryConfigResponse
    -> Int -> DeleteDirectoryConfigResponse)
-> Lens
     DeleteDirectoryConfigResponse DeleteDirectoryConfigResponse Int Int
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