{-# 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.DataBrew.DeleteSchedule
-- 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 DataBrew schedule.
module Amazonka.DataBrew.DeleteSchedule
  ( -- * Creating a Request
    DeleteSchedule (..),
    newDeleteSchedule,

    -- * Request Lenses
    deleteSchedule_name,

    -- * Destructuring the Response
    DeleteScheduleResponse (..),
    newDeleteScheduleResponse,

    -- * Response Lenses
    deleteScheduleResponse_httpStatus,
    deleteScheduleResponse_name,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteSchedule' 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:
--
-- 'name', 'deleteSchedule_name' - The name of the schedule to be deleted.
newDeleteSchedule ::
  -- | 'name'
  Prelude.Text ->
  DeleteSchedule
newDeleteSchedule :: Text -> DeleteSchedule
newDeleteSchedule Text
pName_ =
  DeleteSchedule' {$sel:name:DeleteSchedule' :: Text
name = Text
pName_}

-- | The name of the schedule to be deleted.
deleteSchedule_name :: Lens.Lens' DeleteSchedule Prelude.Text
deleteSchedule_name :: Lens' DeleteSchedule Text
deleteSchedule_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchedule' {Text
name :: Text
$sel:name:DeleteSchedule' :: DeleteSchedule -> Text
name} -> Text
name) (\s :: DeleteSchedule
s@DeleteSchedule' {} Text
a -> DeleteSchedule
s {$sel:name:DeleteSchedule' :: Text
name = Text
a} :: DeleteSchedule)

instance Core.AWSRequest DeleteSchedule where
  type
    AWSResponse DeleteSchedule =
      DeleteScheduleResponse
  request :: (Service -> Service) -> DeleteSchedule -> Request DeleteSchedule
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 DeleteSchedule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchedule)))
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 -> DeleteScheduleResponse
DeleteScheduleResponse'
            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
"Name")
      )

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

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

instance Data.ToHeaders DeleteSchedule where
  toHeaders :: DeleteSchedule -> 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 DeleteSchedule where
  toPath :: DeleteSchedule -> ByteString
toPath DeleteSchedule' {Text
name :: Text
$sel:name:DeleteSchedule' :: DeleteSchedule -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/schedules/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]

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

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

-- |
-- Create a value of 'DeleteScheduleResponse' 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', 'deleteScheduleResponse_httpStatus' - The response's http status code.
--
-- 'name', 'deleteScheduleResponse_name' - The name of the schedule that was deleted.
newDeleteScheduleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'name'
  Prelude.Text ->
  DeleteScheduleResponse
newDeleteScheduleResponse :: Int -> Text -> DeleteScheduleResponse
newDeleteScheduleResponse Int
pHttpStatus_ Text
pName_ =
  DeleteScheduleResponse'
    { $sel:httpStatus:DeleteScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:name:DeleteScheduleResponse' :: Text
name = Text
pName_
    }

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

-- | The name of the schedule that was deleted.
deleteScheduleResponse_name :: Lens.Lens' DeleteScheduleResponse Prelude.Text
deleteScheduleResponse_name :: Lens' DeleteScheduleResponse Text
deleteScheduleResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteScheduleResponse' {Text
name :: Text
$sel:name:DeleteScheduleResponse' :: DeleteScheduleResponse -> Text
name} -> Text
name) (\s :: DeleteScheduleResponse
s@DeleteScheduleResponse' {} Text
a -> DeleteScheduleResponse
s {$sel:name:DeleteScheduleResponse' :: Text
name = Text
a} :: DeleteScheduleResponse)

instance Prelude.NFData DeleteScheduleResponse where
  rnf :: DeleteScheduleResponse -> ()
rnf DeleteScheduleResponse' {Int
Text
name :: Text
httpStatus :: Int
$sel:name:DeleteScheduleResponse' :: DeleteScheduleResponse -> Text
$sel:httpStatus:DeleteScheduleResponse' :: DeleteScheduleResponse -> 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
name