{-# 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.SecurityLake.DeleteCustomLogSource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes a custom log source from Amazon Security Lake.
module Amazonka.SecurityLake.DeleteCustomLogSource
  ( -- * Creating a Request
    DeleteCustomLogSource (..),
    newDeleteCustomLogSource,

    -- * Request Lenses
    deleteCustomLogSource_customSourceName,

    -- * Destructuring the Response
    DeleteCustomLogSourceResponse (..),
    newDeleteCustomLogSourceResponse,

    -- * Response Lenses
    deleteCustomLogSourceResponse_httpStatus,
    deleteCustomLogSourceResponse_customDataLocation,
  )
where

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

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

-- |
-- Create a value of 'DeleteCustomLogSource' 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:
--
-- 'customSourceName', 'deleteCustomLogSource_customSourceName' - The custom source name for the custom log source.
newDeleteCustomLogSource ::
  -- | 'customSourceName'
  Prelude.Text ->
  DeleteCustomLogSource
newDeleteCustomLogSource :: Text -> DeleteCustomLogSource
newDeleteCustomLogSource Text
pCustomSourceName_ =
  DeleteCustomLogSource'
    { $sel:customSourceName:DeleteCustomLogSource' :: Text
customSourceName =
        Text
pCustomSourceName_
    }

-- | The custom source name for the custom log source.
deleteCustomLogSource_customSourceName :: Lens.Lens' DeleteCustomLogSource Prelude.Text
deleteCustomLogSource_customSourceName :: Lens' DeleteCustomLogSource Text
deleteCustomLogSource_customSourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomLogSource' {Text
customSourceName :: Text
$sel:customSourceName:DeleteCustomLogSource' :: DeleteCustomLogSource -> Text
customSourceName} -> Text
customSourceName) (\s :: DeleteCustomLogSource
s@DeleteCustomLogSource' {} Text
a -> DeleteCustomLogSource
s {$sel:customSourceName:DeleteCustomLogSource' :: Text
customSourceName = Text
a} :: DeleteCustomLogSource)

instance Core.AWSRequest DeleteCustomLogSource where
  type
    AWSResponse DeleteCustomLogSource =
      DeleteCustomLogSourceResponse
  request :: (Service -> Service)
-> DeleteCustomLogSource -> Request DeleteCustomLogSource
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteCustomLogSource
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCustomLogSource)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> DeleteCustomLogSourceResponse
DeleteCustomLogSourceResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"customDataLocation")
      )

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

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

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

instance Data.ToPath DeleteCustomLogSource where
  toPath :: DeleteCustomLogSource -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/logsources/custom"

instance Data.ToQuery DeleteCustomLogSource where
  toQuery :: DeleteCustomLogSource -> QueryString
toQuery DeleteCustomLogSource' {Text
customSourceName :: Text
$sel:customSourceName:DeleteCustomLogSource' :: DeleteCustomLogSource -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"customSourceName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
customSourceName]

-- | /See:/ 'newDeleteCustomLogSourceResponse' smart constructor.
data DeleteCustomLogSourceResponse = DeleteCustomLogSourceResponse'
  { -- | The response's http status code.
    DeleteCustomLogSourceResponse -> Int
httpStatus :: Prelude.Int,
    -- | The location of the partition in the Amazon S3 bucket for Security Lake.
    DeleteCustomLogSourceResponse -> Text
customDataLocation :: Prelude.Text
  }
  deriving (DeleteCustomLogSourceResponse
-> DeleteCustomLogSourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCustomLogSourceResponse
-> DeleteCustomLogSourceResponse -> Bool
$c/= :: DeleteCustomLogSourceResponse
-> DeleteCustomLogSourceResponse -> Bool
== :: DeleteCustomLogSourceResponse
-> DeleteCustomLogSourceResponse -> Bool
$c== :: DeleteCustomLogSourceResponse
-> DeleteCustomLogSourceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteCustomLogSourceResponse]
ReadPrec DeleteCustomLogSourceResponse
Int -> ReadS DeleteCustomLogSourceResponse
ReadS [DeleteCustomLogSourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCustomLogSourceResponse]
$creadListPrec :: ReadPrec [DeleteCustomLogSourceResponse]
readPrec :: ReadPrec DeleteCustomLogSourceResponse
$creadPrec :: ReadPrec DeleteCustomLogSourceResponse
readList :: ReadS [DeleteCustomLogSourceResponse]
$creadList :: ReadS [DeleteCustomLogSourceResponse]
readsPrec :: Int -> ReadS DeleteCustomLogSourceResponse
$creadsPrec :: Int -> ReadS DeleteCustomLogSourceResponse
Prelude.Read, Int -> DeleteCustomLogSourceResponse -> ShowS
[DeleteCustomLogSourceResponse] -> ShowS
DeleteCustomLogSourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCustomLogSourceResponse] -> ShowS
$cshowList :: [DeleteCustomLogSourceResponse] -> ShowS
show :: DeleteCustomLogSourceResponse -> String
$cshow :: DeleteCustomLogSourceResponse -> String
showsPrec :: Int -> DeleteCustomLogSourceResponse -> ShowS
$cshowsPrec :: Int -> DeleteCustomLogSourceResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteCustomLogSourceResponse x
-> DeleteCustomLogSourceResponse
forall x.
DeleteCustomLogSourceResponse
-> Rep DeleteCustomLogSourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteCustomLogSourceResponse x
-> DeleteCustomLogSourceResponse
$cfrom :: forall x.
DeleteCustomLogSourceResponse
-> Rep DeleteCustomLogSourceResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCustomLogSourceResponse' 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', 'deleteCustomLogSourceResponse_httpStatus' - The response's http status code.
--
-- 'customDataLocation', 'deleteCustomLogSourceResponse_customDataLocation' - The location of the partition in the Amazon S3 bucket for Security Lake.
newDeleteCustomLogSourceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'customDataLocation'
  Prelude.Text ->
  DeleteCustomLogSourceResponse
newDeleteCustomLogSourceResponse :: Int -> Text -> DeleteCustomLogSourceResponse
newDeleteCustomLogSourceResponse
  Int
pHttpStatus_
  Text
pCustomDataLocation_ =
    DeleteCustomLogSourceResponse'
      { $sel:httpStatus:DeleteCustomLogSourceResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:customDataLocation:DeleteCustomLogSourceResponse' :: Text
customDataLocation = Text
pCustomDataLocation_
      }

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

-- | The location of the partition in the Amazon S3 bucket for Security Lake.
deleteCustomLogSourceResponse_customDataLocation :: Lens.Lens' DeleteCustomLogSourceResponse Prelude.Text
deleteCustomLogSourceResponse_customDataLocation :: Lens' DeleteCustomLogSourceResponse Text
deleteCustomLogSourceResponse_customDataLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomLogSourceResponse' {Text
customDataLocation :: Text
$sel:customDataLocation:DeleteCustomLogSourceResponse' :: DeleteCustomLogSourceResponse -> Text
customDataLocation} -> Text
customDataLocation) (\s :: DeleteCustomLogSourceResponse
s@DeleteCustomLogSourceResponse' {} Text
a -> DeleteCustomLogSourceResponse
s {$sel:customDataLocation:DeleteCustomLogSourceResponse' :: Text
customDataLocation = Text
a} :: DeleteCustomLogSourceResponse)

instance Prelude.NFData DeleteCustomLogSourceResponse where
  rnf :: DeleteCustomLogSourceResponse -> ()
rnf DeleteCustomLogSourceResponse' {Int
Text
customDataLocation :: Text
httpStatus :: Int
$sel:customDataLocation:DeleteCustomLogSourceResponse' :: DeleteCustomLogSourceResponse -> Text
$sel:httpStatus:DeleteCustomLogSourceResponse' :: DeleteCustomLogSourceResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
customDataLocation