{-# 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.DirectoryService.DeleteLogSubscription
-- 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 log subscription.
module Amazonka.DirectoryService.DeleteLogSubscription
  ( -- * Creating a Request
    DeleteLogSubscription (..),
    newDeleteLogSubscription,

    -- * Request Lenses
    deleteLogSubscription_directoryId,

    -- * Destructuring the Response
    DeleteLogSubscriptionResponse (..),
    newDeleteLogSubscriptionResponse,

    -- * Response Lenses
    deleteLogSubscriptionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types
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:/ 'newDeleteLogSubscription' smart constructor.
data DeleteLogSubscription = DeleteLogSubscription'
  { -- | Identifier of the directory whose log subscription you want to delete.
    DeleteLogSubscription -> Text
directoryId :: Prelude.Text
  }
  deriving (DeleteLogSubscription -> DeleteLogSubscription -> Bool
(DeleteLogSubscription -> DeleteLogSubscription -> Bool)
-> (DeleteLogSubscription -> DeleteLogSubscription -> Bool)
-> Eq DeleteLogSubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLogSubscription -> DeleteLogSubscription -> Bool
$c/= :: DeleteLogSubscription -> DeleteLogSubscription -> Bool
== :: DeleteLogSubscription -> DeleteLogSubscription -> Bool
$c== :: DeleteLogSubscription -> DeleteLogSubscription -> Bool
Prelude.Eq, ReadPrec [DeleteLogSubscription]
ReadPrec DeleteLogSubscription
Int -> ReadS DeleteLogSubscription
ReadS [DeleteLogSubscription]
(Int -> ReadS DeleteLogSubscription)
-> ReadS [DeleteLogSubscription]
-> ReadPrec DeleteLogSubscription
-> ReadPrec [DeleteLogSubscription]
-> Read DeleteLogSubscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLogSubscription]
$creadListPrec :: ReadPrec [DeleteLogSubscription]
readPrec :: ReadPrec DeleteLogSubscription
$creadPrec :: ReadPrec DeleteLogSubscription
readList :: ReadS [DeleteLogSubscription]
$creadList :: ReadS [DeleteLogSubscription]
readsPrec :: Int -> ReadS DeleteLogSubscription
$creadsPrec :: Int -> ReadS DeleteLogSubscription
Prelude.Read, Int -> DeleteLogSubscription -> ShowS
[DeleteLogSubscription] -> ShowS
DeleteLogSubscription -> String
(Int -> DeleteLogSubscription -> ShowS)
-> (DeleteLogSubscription -> String)
-> ([DeleteLogSubscription] -> ShowS)
-> Show DeleteLogSubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLogSubscription] -> ShowS
$cshowList :: [DeleteLogSubscription] -> ShowS
show :: DeleteLogSubscription -> String
$cshow :: DeleteLogSubscription -> String
showsPrec :: Int -> DeleteLogSubscription -> ShowS
$cshowsPrec :: Int -> DeleteLogSubscription -> ShowS
Prelude.Show, (forall x. DeleteLogSubscription -> Rep DeleteLogSubscription x)
-> (forall x. Rep DeleteLogSubscription x -> DeleteLogSubscription)
-> Generic DeleteLogSubscription
forall x. Rep DeleteLogSubscription x -> DeleteLogSubscription
forall x. DeleteLogSubscription -> Rep DeleteLogSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteLogSubscription x -> DeleteLogSubscription
$cfrom :: forall x. DeleteLogSubscription -> Rep DeleteLogSubscription x
Prelude.Generic)

-- |
-- Create a value of 'DeleteLogSubscription' 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:
--
-- 'directoryId', 'deleteLogSubscription_directoryId' - Identifier of the directory whose log subscription you want to delete.
newDeleteLogSubscription ::
  -- | 'directoryId'
  Prelude.Text ->
  DeleteLogSubscription
newDeleteLogSubscription :: Text -> DeleteLogSubscription
newDeleteLogSubscription Text
pDirectoryId_ =
  DeleteLogSubscription' :: Text -> DeleteLogSubscription
DeleteLogSubscription' {$sel:directoryId:DeleteLogSubscription' :: Text
directoryId = Text
pDirectoryId_}

-- | Identifier of the directory whose log subscription you want to delete.
deleteLogSubscription_directoryId :: Lens.Lens' DeleteLogSubscription Prelude.Text
deleteLogSubscription_directoryId :: (Text -> f Text)
-> DeleteLogSubscription -> f DeleteLogSubscription
deleteLogSubscription_directoryId = (DeleteLogSubscription -> Text)
-> (DeleteLogSubscription -> Text -> DeleteLogSubscription)
-> Lens DeleteLogSubscription DeleteLogSubscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLogSubscription' {Text
directoryId :: Text
$sel:directoryId:DeleteLogSubscription' :: DeleteLogSubscription -> Text
directoryId} -> Text
directoryId) (\s :: DeleteLogSubscription
s@DeleteLogSubscription' {} Text
a -> DeleteLogSubscription
s {$sel:directoryId:DeleteLogSubscription' :: Text
directoryId = Text
a} :: DeleteLogSubscription)

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

instance Prelude.NFData DeleteLogSubscription

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

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

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

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

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

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

instance Prelude.NFData DeleteLogSubscriptionResponse