{-# 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-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 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 Amazonka.DataBrew.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:/ 'newDeleteSchedule' smart constructor.
data DeleteSchedule = DeleteSchedule'
  { -- | The name of the schedule to be deleted.
    DeleteSchedule -> Text
name :: Prelude.Text
  }
  deriving (DeleteSchedule -> DeleteSchedule -> Bool
(DeleteSchedule -> DeleteSchedule -> Bool)
-> (DeleteSchedule -> DeleteSchedule -> Bool) -> Eq DeleteSchedule
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]
(Int -> ReadS DeleteSchedule)
-> ReadS [DeleteSchedule]
-> ReadPrec DeleteSchedule
-> ReadPrec [DeleteSchedule]
-> Read 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
(Int -> DeleteSchedule -> ShowS)
-> (DeleteSchedule -> String)
-> ([DeleteSchedule] -> ShowS)
-> Show DeleteSchedule
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. DeleteSchedule -> Rep DeleteSchedule x)
-> (forall x. Rep DeleteSchedule x -> DeleteSchedule)
-> Generic DeleteSchedule
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' :: Text -> DeleteSchedule
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 :: (Text -> f Text) -> DeleteSchedule -> f DeleteSchedule
deleteSchedule_name = (DeleteSchedule -> Text)
-> (DeleteSchedule -> Text -> DeleteSchedule)
-> Lens DeleteSchedule DeleteSchedule Text Text
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 :: DeleteSchedule -> Request DeleteSchedule
request = Service -> DeleteSchedule -> Request DeleteSchedule
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSchedule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchedule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteSchedule))
-> Logger
-> Service
-> Proxy DeleteSchedule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchedule)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> DeleteScheduleResponse
DeleteScheduleResponse'
            (Int -> Text -> DeleteScheduleResponse)
-> Either String Int
-> Either String (Text -> DeleteScheduleResponse)
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))
            Either String (Text -> DeleteScheduleResponse)
-> Either String Text -> Either String DeleteScheduleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Name")
      )

instance Prelude.Hashable DeleteSchedule

instance Prelude.NFData DeleteSchedule

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

instance Core.ToQuery DeleteSchedule where
  toQuery :: DeleteSchedule -> QueryString
toQuery = QueryString -> DeleteSchedule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteScheduleResponse -> DeleteScheduleResponse -> Bool)
-> (DeleteScheduleResponse -> DeleteScheduleResponse -> Bool)
-> Eq DeleteScheduleResponse
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]
(Int -> ReadS DeleteScheduleResponse)
-> ReadS [DeleteScheduleResponse]
-> ReadPrec DeleteScheduleResponse
-> ReadPrec [DeleteScheduleResponse]
-> Read 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
(Int -> DeleteScheduleResponse -> ShowS)
-> (DeleteScheduleResponse -> String)
-> ([DeleteScheduleResponse] -> ShowS)
-> Show DeleteScheduleResponse
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. DeleteScheduleResponse -> Rep DeleteScheduleResponse x)
-> (forall x.
    Rep DeleteScheduleResponse x -> DeleteScheduleResponse)
-> Generic DeleteScheduleResponse
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' :: Int -> Text -> DeleteScheduleResponse
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 :: (Int -> f Int)
-> DeleteScheduleResponse -> f DeleteScheduleResponse
deleteScheduleResponse_httpStatus = (DeleteScheduleResponse -> Int)
-> (DeleteScheduleResponse -> Int -> DeleteScheduleResponse)
-> Lens DeleteScheduleResponse DeleteScheduleResponse Int Int
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 :: (Text -> f Text)
-> DeleteScheduleResponse -> f DeleteScheduleResponse
deleteScheduleResponse_name = (DeleteScheduleResponse -> Text)
-> (DeleteScheduleResponse -> Text -> DeleteScheduleResponse)
-> Lens DeleteScheduleResponse DeleteScheduleResponse Text Text
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